Testing to see if another Macro is running

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
electroh
Newbie
Posts: 10
Joined: Wed Feb 05, 2003 9:10 pm

Testing to see if another Macro is running

Post by electroh » Mon Apr 11, 2005 3:06 pm

I want to check to see if another Macro is running before starting a different Macro.
Along the lines of IFMacroRunning>"Macro A", Do this(True), Start Macro B(False)
Can anyone help with the correct syntax.
Thanks
Richard

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 11, 2005 3:32 pm

Have MacroA update a flag in an INI file when it starts. MacroB checks this value and if set does -this- and if not does -that-. MacroA resets the flag on exit.

This solution was given in this topic:
http://www.mjtnet.com/forum/viewtopic.p ... eadinifile

MacroA:
EditIniFile>status.ini,MacroA,Status,Running
.
. whatever
.
Label>Done
EditIniFile>status.ini,MacroA,Status,Idle

MacroB:
ReadIniFile>status.ini,MacroA,Status,status
IF>status=Running
do -this-
Else
do -that-
EndIf

HTH
MJT Net Support
[email protected]

electroh
Newbie
Posts: 10
Joined: Wed Feb 05, 2003 9:10 pm

Post by electroh » Mon Apr 11, 2005 3:56 pm

Many thanks

electroh
Newbie
Posts: 10
Joined: Wed Feb 05, 2003 9:10 pm

Post by electroh » Tue Apr 12, 2005 11:14 am

I have created a status.ini file,

[MacroA]
Status=Idle
Idle=Running
[MacroB]
Status=Idle
[MacroC]
Status=Idle

but I am finding a line being inserted: Idle=Running !! Using the following code

ReadIniFile>status.ini,MacroA,Status,state
IF>state=Running,NoRun
EditIniFile>status.ini,MacroA,Status,Running

...

Label>NoRun

Im not sure where I'm going wrong here.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 12, 2005 11:26 am

Nothing wrong with the code you have posted. But perhaps you have created a variable called Status and set it to Idle before the EditIniFile command. Or maybe you accidentally put State into the EditIniFile command instead of Status. Since State=Idle this would create a setting Idle=Running.

This code works fine:

ReadIniFile>status.ini,MacroA,Status,state
IF>state=Running,NoRun
EditIniFile>status.ini,MacroA,Status,Running

So perhaps you've set Status to Idle instead of state at some point.
MJT Net Support
[email protected]

electroh
Newbie
Posts: 10
Joined: Wed Feb 05, 2003 9:10 pm

Post by electroh » Tue Apr 12, 2005 12:30 pm

Thanks again for your fast response.

I found the problem in MacroC, originally I used Status as a variable, then decided to change it to State, but missed it in that one Macro.

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