Page 1 of 1

Simple Parameter passing

Posted: 06 Nov 2013 08:06
by ramiro9
How do you pass parameters to a command? I want to do something like (Pseudocode):
"C:\Program Files (x86)\FLAC\flac64.exe" -6 -V <openmultipleitemsoneatatime>
so I can assign it to a custom button.

When applied to a .wav audio file, this command will convert it into a .flac audio file.

I have successfully assigned it to a "openwith" "multipleinstance" user command and a kb shortcut, I would like to create a 'script' so I can assign this to a button. All my efforts have failed because the parameters don't get passed correctly -- I get an error message that says "Failed to open -6"

Thank you.

Re: Simple Parameter passing

Posted: 06 Nov 2013 08:33
by highend

Code: Select all

run """C:\Program Files (x86)\FLAC\flac64.exe"" -6 -V ""<openmultipleitemsoneatatime>"""
But ofc it depends on flac64.exe if it supports these multiple items in one call. Otherwise
you'll have to use a foreach loop.

Re: Simple Parameter passing

Posted: 07 Nov 2013 04:10
by ramiro9
Your answer provided me with the quotes and escape marks I was missing. Thank you for your assistance!

My final button script:
openwith """C:\Program Files\FLAC\flac.exe"" <curitem> /-6 /-V", m

It processes multiple items with multiple instances.

Re: Simple Parameter passing

Posted: 07 Nov 2013 08:43
by highend
In general it's better to use two double quotes around variable names in openwith / run commands (to ensure that everything works ok if it contains spaces).