Running Scripts in Parallel

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
promacronoob
Newbie
Posts: 4
Joined: Thu Jul 06, 2017 12:19 pm

Running Scripts in Parallel

Post by promacronoob » Thu Jul 06, 2017 12:34 pm

I am trying to search for general errors in the software I am running throughout whole script . Is it possible to run two scripts in parallel to help with error trapping?

If this is not possible is there another way besides hard coding error traps with If statements and while loops between steps of my code.

Thanks

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

Re: Running Scripts in Parallel

Post by JRL » Thu Jul 06, 2017 6:44 pm

It is easy to run two or more scripts. Just be cautious about using UI calls in each or they will certainly interfere with each other. What I like to do is run the error trapping script from the primary script by adding an ExecuteFile> line at or near the top of the primary script. If the two scripts live in the same folder the second script can be called using "Script_Dir%\ as the path, otherwise the script needs to be fully pathed to work.

For example you might create an error trapping script named "TrapErrors.scp" and place it in the same folder as the primary script. The primary script would then have a line.

ExecuteFile>%script_dir%\TrapErrors.scp

Be sure to include a method to kill the error trapping script in the error trapping script. I like to use OnEvent> with a key combination. Another that I've used is OnEvent> with "FileExists" then have the primary script create a file that the secondary script detects. The secondary script, upon detecting the file, deletes the file then Exit>s.

I'm assuming your error trapping script will be performing actions of its own, otherwise it might be easier to simply set up logging on the primary script.

promacronoob
Newbie
Posts: 4
Joined: Thu Jul 06, 2017 12:19 pm

Re: Running Scripts in Parallel

Post by promacronoob » Thu Jul 06, 2017 7:25 pm

Thank you for the quick and thorough response JRL! I am trying to run a timeout macro in combination with my automation macro. This opens the door for many more possibilities.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: Running Scripts in Parallel

Post by Phil Pendlebury » Fri Jul 28, 2017 8:53 am

Excellent insight JRL I have been using various types of logging with switches in an ini file that the customer can alter. But I love the OnEvent> with "FileExists" idea. :-)
Phil Pendlebury - Linktree

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