Question about Script Control

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Question about Script Control

Post by Tourless » Tue Apr 04, 2023 6:37 pm

Hi Folks.

So I'm running into an issue with certain scripts not completing due to a variety of different reasons. All the scripts in question begin by opening a website. Sometimes that website will have an informational pop-up that when acknowledged once, will never again appear. Other times the page may take a long time or never fully load due to 'web bugs'. But those sorts of things throw my scripts into a fit not knowing how to account for that, until it eventually throws an error (blah blah blah, line 164, continue or abort). Now that's not insurmountable but the problem comes in when that error is not acknowledged right away and it causes all the other scripts that are scheduled after it to not run due to this active one being hung up.

So I guess my question is how do you handle or account for failures or anomalies that could cause a script to fail?

My current thinking is to do two things... 1. adding some code at the beginning of the scripts to check for open windows and force them closed to start with a clean slate. 2. add a timer of sorts that would basically say if the script has been running for 10 minutes, end it and start again (knowing the scripts only take 5-7 minutes on average).

Anyone have any ideas or suggestions or examples of ways you have accounted for potential failures and if not eliminated them completely at least minimized their occurrences?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Question about Script Control

Post by Dorian (MJT support) » Tue Apr 04, 2023 7:35 pm

Your first option can work depending on the situation, but if your script actually throw errors, this article on error handling will help.

Of course you can always make your script wait for images/objects/buttons etc and if it doesn't find them after your pre-determined time, abort. Controlling timing is a major part of script creation.
Yes, we have a Custom Scripting Service. Message me or go here

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