Simple Parameter passing

Discuss and share scripts and script files...
Post Reply
ramiro9
Posts: 4
Joined: 23 Aug 2011 20:18

Simple Parameter passing

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

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Simple Parameter passing

Post 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.
One of my scripts helped you out? Please donate via Paypal

ramiro9
Posts: 4
Joined: 23 Aug 2011 20:18

Re: Simple Parameter passing

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

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Simple Parameter passing

Post 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).
One of my scripts helped you out? Please donate via Paypal

Post Reply