Hi All,
I am totally new to Macro Scheduler. I don't have much time to explore it also:( . But I used some similar kind of tool before and found difficulties after compiling the scripts to execuatble (so that it can run on any machine).
Suppose I have two scripts A.scp and B.scp. A.scp calls B.scp internally. Both scripts shares some common variables. Now I make the exe files for
both scripts after compiling. Can anyone please tell step wise to make the exe files running in any machine? The scenarion is as given below:
A.exe
---------
Var a=0
If a = 0
do some tasks..
end if
call B.exe
Wait for B.exe to be finished
exit
B.exe
---------
Increment a+1
If a = 1
do some tasks..
end if
Thanks..
Shared Variable scopes for dependent compiled scripts
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 63
- Joined: Thu Dec 10, 2009 8:13 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just use the Include> statement:
A.exe
------
Let>a=0
If>a=0
//do something
Endif
Include>b.scp
B.scp
------
Let>a=a+1
etc
You only need to compile A.scp to A.exe. When you compile check the box "Compile Includes".
Then everything is included in the one exe.
Read this:
http://www.mjtnet.com/blog/2009/09/09/i ... ary-files/
A.exe
------
Let>a=0
If>a=0
//do something
Endif
Include>b.scp
B.scp
------
Let>a=a+1
etc
You only need to compile A.scp to A.exe. When you compile check the box "Compile Includes".
Then everything is included in the one exe.
Read this:
http://www.mjtnet.com/blog/2009/09/09/i ... ary-files/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 63
- Joined: Thu Dec 10, 2009 8:13 am
Got it! But did not understand the variable scopes
Thanks..
But how to distinguish between the local variables with same name? Is there any provision to avoid collision like we use scope resolution operator in different languages?
But how to distinguish between the local variables with same name? Is there any provision to avoid collision like we use scope resolution operator in different languages?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
In Macro Scheduler all variables have global scope. So if you use Include ALL variables are shared. If you want to avoid collisions, use a prefix or naming system that relates to the script name.
(We *may* introduce the ability to define local scope variables in a future version).
(We *may* introduce the ability to define local scope variables in a future version).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 63
- Joined: Thu Dec 10, 2009 8:13 am
Macro Vs Include and Precautions before & after compilat
Hi,
Can't we use MACRO instead of Include here?
Can I try Macro>b.scp /a to do the same? (So that I can avoid the variable collisions)
I tried Include>b.scp in a.scp. (But it didnt work)
But after I tried Include>%SCRIPT_DIR%\b.scp. Do we need to mention %SCRIPT_DIR% before calling any macro(even both present in same dir)?Does it always work even after compilation and running those in any other desktop? Any precution do we need to take while creating the scripts so that it will always run in any desktop?
Can't we use MACRO instead of Include here?
Can I try Macro>b.scp /a to do the same? (So that I can avoid the variable collisions)
I tried Include>b.scp in a.scp. (But it didnt work)
But after I tried Include>%SCRIPT_DIR%\b.scp. Do we need to mention %SCRIPT_DIR% before calling any macro(even both present in same dir)?Does it always work even after compilation and running those in any other desktop? Any precution do we need to take while creating the scripts so that it will always run in any desktop?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes. Macro> starts the second macro in it's own scope. And you can pass variables into it via the command line as you suggest. You need to specify the full path to the macro file:
Macro>%SCRIPT_DIR%\macroB.scp /A=...
But, when compiled macroB is NOT compiled as part of the main macro. The Macro command runs an external .scp file. It does this whether your calling macro is compiled or not compiled.
What you could do is also compiled macroB to an exe file and then use:
Let>RP_WAIT=1
Run>%SCRIPT_DIR%\macroB.EXE /A=...
Then you would compiled all scripts and distribute them together. So you could have A.exe calling B.exe which could be in the same folder.
Macro>%SCRIPT_DIR%\macroB.scp /A=...
But, when compiled macroB is NOT compiled as part of the main macro. The Macro command runs an external .scp file. It does this whether your calling macro is compiled or not compiled.
What you could do is also compiled macroB to an exe file and then use:
Let>RP_WAIT=1
Run>%SCRIPT_DIR%\macroB.EXE /A=...
Then you would compiled all scripts and distribute them together. So you could have A.exe calling B.exe which could be in the same folder.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Perhaps I'm naive but when I need to pass variable values from one script or executable to another script or executable, I write the values to a temporary file. In my experience writing to and reading from small files is extremely fast. I understand that passing the values globally is faster but that is not an option in Macro Scheduler.