Page 1 of 1

Toolbar Button Parameters

Posted: Wed Nov 13, 2013 7:26 pm
by Brother Gabriel-Marie
When I add a button to the toolbar, is there any tokens to use if I want to specify a parameter?

For example, say I add a button for my program. I want to put something like this in the toolbar button's command box.
myprogram.exe -param1 %selectedfile%

I think what happens right now is that the selected files get sent as commandline parameters, but I don't see any way to modify the commandline to add my own switches.

Re: Toolbar Button Parameters

Posted: Wed Nov 13, 2013 7:31 pm
by xnview
In .bar file, you can use

Code: Select all

button1=icon_filename
cmd1=cmd_string

Re: Toolbar Button Parameters

Posted: Wed Nov 13, 2013 8:01 pm
by Brother Gabriel-Marie
Thanks, Mr. XnView.

So, for cmd_string, should I use %1 to indicate the file like I would in Explorer? I understand I can specify the commandline, but how do I pass the filename?

Re: Toolbar Button Parameters

Posted: Thu Nov 14, 2013 9:22 am
by xnview
The filename is added at the end

Re: Toolbar Button Parameters

Posted: Thu Nov 14, 2013 3:12 pm
by Brother Gabriel-Marie
Pierre,

It doesn't seem to work if I add a switch.

If I do not add any parameters or switches, it works fine:
button1=c:\myprogram.exe
cmd1=c:\myprogram.exe
The app receives the passed filename

If I do this, it does not works:
button1=c:\myprogram.exe
cmd1=c:\myprogram.exe -aparameter
Nothing happens, although it works if I do it via commandline myself

But if there were a variable/token to indicate to indicate a placeholder for the filename, then I could work on mutliple selections.
Here is what I want to be able to do:
button1=c:\myprogram.exe
cmd1=c:\myprogram.exe -aparameter %path1% %path2%

Re: Toolbar Button Parameters

Posted: Fri Nov 15, 2013 8:30 am
by xnview
right currently a problem, you must use a .bat instead

Re: Toolbar Button Parameters

Posted: Fri Nov 15, 2013 3:10 pm
by Brother Gabriel-Marie
Pierre,

Ah, okay. That's what I was guessing. Thanks for answering and confirming that.

Re: Toolbar Button Parameters

Posted: Tue Dec 15, 2020 8:18 pm
by Brother Gabriel-Marie
Pierre,

Is this fixed yet, perhaps? I am dreaming of being able to specify parameters to custom toolbar buttons.

Basically, I have some autohotkey scripts I want to run on the files by selecting them and pushing the toolbar button. But I need to supply the filename or filename's directory path as parameters to my scripts. So, I am rather still seeking to do what I did the last time I posted.

I have this one script that creates a text file where I store information, but I need to specify the directory path as a parameter to my script...

As things are, the only thing that seems to be sent is the filename if a file is selected.
But I'm needing a token for the current-folder-path.