Toolbar Button Parameters

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

Post Reply
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Toolbar Button Parameters

Post 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.
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Toolbar Button Parameters

Post by xnview »

In .bar file, you can use

Code: Select all

button1=icon_filename
cmd1=cmd_string
Pierre.
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Toolbar Button Parameters

Post 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?
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Toolbar Button Parameters

Post by xnview »

The filename is added at the end
Pierre.
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Toolbar Button Parameters

Post 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%
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Toolbar Button Parameters

Post by xnview »

right currently a problem, you must use a .bat instead
Pierre.
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Toolbar Button Parameters

Post by Brother Gabriel-Marie »

Pierre,

Ah, okay. That's what I was guessing. Thanks for answering and confirming that.
User avatar
Brother Gabriel-Marie
Posts: 286
Joined: Thu Aug 23, 2007 2:33 pm
Location: United States

Re: Toolbar Button Parameters

Post 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.
Post Reply