Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
78 user(s) are online (43 user(s) are browsing Forums)

Members: 1
Guests: 77

MartinW, more...

Headlines

 
  Register To Post  

Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
Hi,
I would like to pass arguments to a Workbench program inside the ContextMenus.cfg but I don't succeed to make it working.

For example,
I try in my ContextMenus.cfg

Multiple,To RAM:,WB,Work:Dev/FastCopy/FastCopy RAM:

to pass the argument "RAM:" to the WB program FastCopy but nothing happes.

When I code

Multiple,To RAM:,WB,Work:Dev/FastCopy/FastCopy,RAM:

The program launch but I just have the selected files in the WBargs and not the "RAM:" parameter.

Is it possible to pass a arbitrary argument to a wb program and to make it inside the ContextMenus.cfg ?

Thank by advance for your kind help

Go to top
Re: Context Menus and argument to WB command ?
Home away from home
Home away from home


See User information
Quote:

Multiple,To RAM:,WB,Work:Dev/FastCopy/FastCopy RAM:


you are attempting to lauch the program

"Work:Dev/FastCopy/FastCopy RAM:"

Quote:

Multiple,To RAM:,WB,Work:Dev/FastCopy/FastCopy,RAM:


RAM: is ignored here as its in an extra field

the defintion should be

<fileclass>,<title>,<execution mode>,<command>

Quote:

Is it possible to pass a arbitrary argument to a wb program and to make it inside the ContextMenus.cfg ?


In general arguments are passed to workbbnch prgrams through the tootypes of the icon being clicked on. Whether that be a program icom itself or a project con with the program set as default tool. So it's not really meaningful to pass arguments in the way you are attempting.

How does fastcopy usually receive the destination argument?

You should use the CLI option

eg making aguess at the programs template, adjust to fit reality...


Multiple,To RAM:,CLI,Work:Dev/FastCopy/FastCopy DEST RAM: FILES {F}

The following is taken from the docs available in SYS:Documentation/Comoddities/ContextMenus.doc [edit]tried add a file url but it added http to it, not helpful [/edit]

Quote:

Special arguments:

Some special arguments can be used in the command executed when a menu
item is clicked. Those arguments will be replaced accordingly before
execution of the command.
Arguments can be used in general menus or tooltype ones and any number of
them can be used at once.


"%o" will be replaced by the filename of the file under
the mouse pointer (even if multiple files are selected)
"%O" will be replaced by the filename of all selected files
Note: "O" stands for "only".

"%f" will be replaced by the full name (pathname + filename)
of the file under the mouse pointer (even if multiple files
are selected)
"%F" will be replaced by the full name of all selected files
Note: "F" stands for "full".

"%i" works like %o but the icon name is also processed
"%I" works like %O but icon names are also processed
Note: "I" stands for "icons".

"%a" works like %f but the icon name is also processed
"%A" works like %F but icon names are also processed
Note: "A" stands for "all".

Examples:
Copy %i ram: -> Copy file file.info ram:
rx script.rexx %o -> then retrieve the filename in your script

"%d" will be replaced by the directory name where the
menu item is used (i.e. the current directory).


Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
Thank you Broadblues,
I read the doc before to ask and in fact find just the way to do for CLI.

I had tried CLI (with standard argv array) but my program ran 1 time for each files, but just 1 time for all files with WB type (what I wanted)

I have to review my program to make CLI compatible...

Thank again :)

Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information

Just tried with CLI type with %A option (for all files including .info) but I really have a problem when more than 4 files are selected.

With 4 files or less, my program is fired just one time
With 5 files, my program is fired twice (???)

I put this in my ContextMenus.cfg
Multiple,To RAM:,CLI,Work:Dev/FastCopy/FastCopy RAM: %A

My program just do

int main(int argc,char **argv)
{
int i = 1;
printf("Run from CLI, %d args.\n",argc);

for (i = 1; i < argc ; i++)
{
printf("%s ",argv[i]);
}
}

and with more than 4 files I obtain 2 running instances of my program.

http://zzd10h.amiga-ng.org/FastCopy/ContextMenu_CLI_KO.jpg

With WB type, I have all my files in just one instance (great!), unfortunately I can't pass a argument by command line...

Is somebody could spot my mistake, please ?

Thank by advance.

Go to top
Re: Context Menus and argument to WB command ?
Home away from home
Home away from home


See User information
You are using coppies of your app to test with.

That's a bad idea. Test with totally separate files, other wise you might well be launching more than 1 file ia ContextMenus.

Also for this test start from 0 so you see which command is printing out. 'd put anew line in to, easier to see what's what



int main(int argc,char **argv)
{
int i = 1;
printf("Run from CLI, %d args.\n",argc);

for (i = 0; i < argc ; i++)
{
printf("%s\n",argv[i]);
}
}

Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
I don't know if I understand well but I have just 1 copy of my prog.
The files that I select are just files like .o .debug and copy of .o and .debug.
There are not my program himself.

And I obtain the 2 debugs log with just 1 run (one click in the contextual menu)

My goal is to select multiple files...

Concretely, I select multiple files in workbench (files that you see selected in the previous grab) and I right click to launch the prog FastCopy who might list me all the files in 1 time.

With the same files minus the last one, it works.
With the 5 files selected, it runs twice.

Yes, I remove the argc[0] because the program name was useless for me.

will add the \n tomorrow, you are right, it will be more easy to read.

Thank you Broadblues, to take in consideration my problem, nice ;)

Go to top
Re: Context Menus and argument to WB command ?
Home away from home
Home away from home


See User information
Yes but are not the .debug versions also executable?

What I'm saying is eliminate the possibility that they being run somehow by choosing "safer" files to test with.

Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
I test the same program from sobjs: (I just add arg[0], no "\n" because with it I just see 3 lines in the debug "console")

1) from sobjs :
http://zzd10h.amiga-ng.org/FastCopy/FastCopy_CLI_Problem.jpg
the first set of 6 files works great
the second set of 6 files is not OK
=> maybe not a number of files problem as I thought initialy

2) from RAM:
http://zzd10h.amiga-ng.org/FastCopy/F ... py_CLI_Length_Problem.jpg
with just 2 set of 2 files
the first set works
the second with very long file names doesn't work

Strange, no ? A name length problem ?

If you have time, I put the program, the source and makefile here :

http://zzd10h.amiga-ng.org/FastCopy/FastCopy.lha

Could you try by adding in your contextualmenu.cfg the following line ?

Multiple,>FastCopy
Multiple,To RAM:,CLI,Work:Dev/FastCopy/FastCopy DEST RAM: FILES %A
Multiple,>FastCopy

and by selecting a lot of files (or a long filenames) ?

Thank by advance :)


Go to top
Re: Context Menus and argument to WB command ?
Just popping in
Just popping in


See User information
Hi dudes,
the limitation is an internal buffer of ContextMenus commodity. It only reserves 256 bytes, to pass to the CLI.
That's bad news.

I'm currently looking into it and hope to fix it soon.

Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
Thank Context for the explanation and for the future fix.

At least, I don't have to continue to search ;)

I'll watch AmiUpdate often...

(thank for your work on ContextMenus, very useful)

Go to top
Re: Context Menus and argument to WB command ?
Just can't stay away
Just can't stay away


See User information
Hello Context,
Do you have good news about the increase of the ContextsMenu buffer ?

Thank you.
Guillaume

Go to top
Re: Context Menus and argument to WB command ?
Quite a regular
Quite a regular


See User information
Yes any news?

AmigaOne X5000
Radeon HD 7700
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project