run program passing parametr

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

run program passing parametr

Post by hoangvo81 » Wed May 28, 2014 5:00 pm

Hi,

I think I losing it, cause i was sure i could pass parameter via runprogram to an exe, the exe is a macro scheduler created exe

exe code:

Code: Select all

MDL>Selected

Main code:

Code: Select all

let>RP_ADMIN=1
   RunProgram>%script_Dir%\displaySelected.exe /selected=123

macro scheduler is complaining that the file does not have a program associated.
if i take out the parameter : /selected=123
mdl display "Selected" as the text so i know the exe works, but i am not sure why i m getting complain about file association when its an exe file.

hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

Re: run program passing parametr

Post by hoangvo81 » Wed May 28, 2014 5:04 pm

opening up command prompt manually and typing in the DisplaySelected.exe /selected=123
works fine and display 123

also tried making it into an exe and running it and still the same complain.

hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

Re: run program passing parametr

Post by hoangvo81 » Wed May 28, 2014 5:07 pm

yet when i pull the exe back to my desktop and ran it, it's fine.
...

hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

Re: run program passing parametr

Post by hoangvo81 » Wed May 28, 2014 5:11 pm

ignore this - i found the problem.

need to enclose the application path in quotes.

runprogram>"%script_Dir%\displayselected.exe" /selected=123


script_dir the folder has spaces so that was causing problem.

but i m not sure why it would run when i remove teh /selected=123 parameter since the spaces is still there.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: run program passing parametr

Post by Marcus Tettmar » Wed May 28, 2014 6:21 pm

Because without quotes windows will treat the whole string as the path. So without the Parms you can get away without quotes. With the Parms quotes are needed so that windows knows which bit is which.


Sent from my iPad using Tapatalk
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

hoangvo81
Pro Scripter
Posts: 69
Joined: Tue Feb 07, 2012 8:02 pm

Re: run program passing parametr

Post by hoangvo81 » Wed May 28, 2014 6:59 pm

Thanks for the explanation.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts