.exe file parameters

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
ibwalkn
Newbie
Posts: 6
Joined: Wed Sep 18, 2013 6:34 pm
Contact:

.exe file parameters

Post by ibwalkn » Wed Sep 18, 2013 6:39 pm

Is it possible to pass parameters to the command line for a compiled macro? If so, what's the way to add a short cut to the desktop or elsewhere to run it with parameters on Windows 7? Also, can a compiled macro .exe file be run with the screen locked?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Sep 19, 2013 4:58 am

Is it possible to pass parameters to the command line for a compiled macro?
If you were to create a simple script with the one line:

Code: Select all

MDL>Parameter_1
Compile the script as Report_Param.exe

Then from a command line run:

Code: Select all

Report_Param.exe /Parameter_1="Some message to be displayed"
You would effectively pass a parameter to the executable. This particular executable will display a message that shows the content of the parameter. Of course you need to either start in the folder that contains the executable or fully path it on the command line.
Also, can a compiled macro .exe file be run with the screen locked?

Any executable can be run while the screen is locked. However if the executable performs interaction with the screen, none of that interaction will take place. The sample script I just suggested above will run, but the message will not display. If on the other hand we added a line that did a WriteLn> of the parameter value to a file, you would find that the file would exist and would contain the passed parameter value.

Code: Select all

WriteLn>%temp_dir%Record_Param.txt,wres,Parameter_1

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Sep 30, 2013 10:29 pm

I am having a rough Monday here...

Report_Param is the single line of code just as JRL suggested:

Code: Select all

MDL>Parameter_1
Running "Report_Param.exe" by itself runs fine and displays "Parameter_1" as expected.

But when I run

Code: Select all

Report_Param.exe /Parameter_1="some text"
"Windows cannot find c:\Users...\Report_Param.exe /Parameter1="some text". Make sure you typed the name correctly and try again.

Suggestions?
Thanks,
Jerry

[email protected]

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

Post by hoangvo81 » Tue Oct 01, 2013 12:35 am

in your code:

Code: Select all

MDL>Parameter_1
MDL>Parameter_2

make the exe
and run command

Report_param.exe /Parameter_1=TEST1 /Parameter_2=TEST2

This works fine like JRL showned

you are assigning the values to the array makes sure in your code its the same array/variable name.

"Windows cannot find c:\Users...\Report_Param.exe /Parameter1="some text". Make sure you typed the name correctly and try again.
your run command shows Parameter1, which is not the same as Parameter_1

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Oct 01, 2013 2:01 pm

Jerry Thomas wrote:"Windows cannot find c:\Users...\Report_Param.exe /Parameter1="some text". Make sure you typed the name correctly and try again.

Suggestions?
"c:\Users...\Report_Param.exe" /Parameter_1="some text"
FIREFIGHTER

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Tue Oct 01, 2013 3:09 pm

Good catch hoangvo81 - in my code they are the same - this was something I messed up copying / pasting

Cyber, I have tried quotes in every possible place/combination


I would have sworn I tried this yesterday but I just found that,
RUN>Report_param.exe /Parameter_1=TEST1 works

But EXE>Report_param.exe only works with NO parameters


Thanks for help!
Thanks,
Jerry

[email protected]

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