Countdown that will restart script?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
houseofadam
Newbie
Posts: 2
Joined: Sun Apr 18, 2021 10:34 pm

Countdown that will restart script?

Post by houseofadam » Sun Apr 18, 2021 10:37 pm

Hello everyone,

Just purchased MS and so far have been really enjoying it. I've run into a stopping point that I can't figure out yet and was hoping one of you has already figured this out.

I'm running a macro that will look for an image and then proceed. At the current time if the image does not appear the macro continues to look for the image. I'd like to set up a timer and if the macro does not detect the image in X time, the script starts over.

Any help would be great. Thanks in advance.

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

Re: Countdown that will restart script?

Post by Dorian (MJT support) » Mon Apr 19, 2021 12:42 pm

This should do that, and the comments should explain it.

Code: Select all

//start label
Label>start

//Set the timeout (in seconds)
Let>WSI_TIMEOUT=10
//Wait for the image 
WaitScreenImage>%BMP_DIR%\image_1.bmp,0.7,CCOEFF

//If none were found after 10 seconds, go to start. If one of more were found, the script will continue.
If>WSI_RESULT<1
  Goto>start
Endif

MessageModal...I continued...
Yes, we have a Custom Scripting Service. Message me or go here

houseofadam
Newbie
Posts: 2
Joined: Sun Apr 18, 2021 10:34 pm

Re: Countdown that will restart script?

Post by houseofadam » Mon Apr 19, 2021 7:38 pm

Thank you so much! I'll test this when I get home today.

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