Toolbar Button Parameters

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

Moderators: XnTriq, xnview

Post Reply
User avatar
Brother Gabriel-Marie
Posts: 278
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: 34090
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: 278
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: 34090
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: 278
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: 34090
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: 278
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.
Post Reply