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
Running Scripts in Parallel
Moderators: Dorian (MJT support), JRL
Re: Running Scripts in Parallel
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.
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.
-
- Newbie
- Posts: 4
- Joined: Thu Jul 06, 2017 12:19 pm
Re: Running Scripts in Parallel
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.
- Phil Pendlebury
- Automation Wizard
- Posts: 538
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Re: Running Scripts in Parallel
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