Pass parameters to a macro/exe and run in the backend

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Niroj@Work
Pro Scripter
Posts: 63
Joined: Thu Dec 10, 2009 8:13 am

Pass parameters to a macro/exe and run in the backend

Post by Niroj@Work » Mon Apr 05, 2010 1:17 pm

Hi,

I need to create a Macro/exe which will get its value passed from another script. Could you please explain the steps for the scenario as given below:

The called Exe:mac_chk.exe
==============
//Value of "k" need to be passed from Parent exe...
Repeat>k
Add>k,1
WriteLn>%flle_nm%,RES,%k%
Until>k=1000

The calling exe:
================
Let> RP_WAIT=0
//Macro>%SCRIPT_DIR%\mac_chk.scp
RunProgram>%SCRIPT_DIR%\mac_chk.exe %k=1
//ExecuteFile>%SCRIPT_DIR%\mac_chk.exe
mdl>I m here...!
//other code....
.....
....
.....

Here I want to run the "mac_chk.exe" in the back-end so RP_WAIT=0 for it.

My main aim is to run "mac_chk.exe" that need to be invoked by the Parent exe without disturbing the flow of parent exe.

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

Post by JRL » Mon Apr 05, 2010 4:51 pm

In "The called Exe:mac_chk.exe" you are OK as-is. Just so you don't redefine the variable "K" prior to the repeat> loop.


Macro Scheduler has built in command line parameter structure. The syntax is:

Filename.exe /variable_name=value

This format will pass a variable "variable_name" with a value of "value" to the Macro Scheduler executable "Filename.exe"

Tharefore:
In your calling exe the RunProgram> line should look like:

RunProgram>%SCRIPT_DIR%\mac_chk.exe /k=1


FYI
As a general rule I advise against using single characters as variable names.

Niroj@Work
Pro Scripter
Posts: 63
Joined: Thu Dec 10, 2009 8:13 am

Post by Niroj@Work » Tue Apr 06, 2010 4:07 am

Thank you again...
This is just a scenario I mentioned..hence used the variable %k% for an example.

I will check as you said..

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