Looping

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Michael_Cypress
Newbie
Posts: 1
Joined: Tue Mar 16, 2021 3:40 pm

Looping

Post by Michael_Cypress » Tue Mar 16, 2021 3:45 pm

Hi All

I am having an issue in looping the script. I need it to run every 85secs (or so). I cannot use the scheduler as this is limited to 1minute intervals. I tried adding a Label/Goto command(with a wait command embedded for 80sec), but after the first pass the script stops operating. I am clearly missing something. Any advise would be appreciated.

Code: Select all

ScreenCapture>1379,191,1509,856,%TEMP_DIR%\screenrect.bmp
//Find and Left Click To the Right of the 
FindImagePos>%BMP_DIR%\image_4.bmp,%TEMP_DIR%\screenrect.bmp,0.7,8,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+1379+80},{%YArr_0%+191}
  LClick
Endif
Wait>1
MouseMove>960,783
Wait>1
LClick
Wait>80
ScreenCapture>1377,185,1516,845,%TEMP_DIR%\screenrect.bmp
//Find and Left Click To the Right of the 
FindImagePos>%BMP_DIR%\image_3.bmp,%TEMP_DIR%\screenrect.bmp,0.7,8,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+1377+80},{%YArr_0%+185}
  Wait>1
  LClick
Endif

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

Re: Looping

Post by Dorian (MJT support) » Tue Mar 16, 2021 5:19 pm

If all you want to do is loop your script indefinitely, a simply Label and Goto should suffice.

These two articles will help you too.

https://help.mjtnet.com/article/210-can ... t-my-macro
https://help.mjtnet.com/article/144-how ... p-the-loop

Code: Select all

Label>Start
ScreenCapture>1379,191,1509,856,%TEMP_DIR%\screenrect.bmp
//Find and Left Click To the Right of the 
FindImagePos>%BMP_DIR%\image_4.bmp,%TEMP_DIR%\screenrect.bmp,0.7,8,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+1379+80},{%YArr_0%+191}
  LClick
Endif
Wait>1
MouseMove>960,783
Wait>1
LClick
Wait>80
ScreenCapture>1377,185,1516,845,%TEMP_DIR%\screenrect.bmp
//Find and Left Click To the Right of the 
FindImagePos>%BMP_DIR%\image_3.bmp,%TEMP_DIR%\screenrect.bmp,0.7,8,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+1377+80},{%YArr_0%+185}
  Wait>1
  LClick
Endif
Goto>Start
Yes, we have a Custom Scripting Service. Message me or go here

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Looping

Post by mightycpa » Tue Mar 16, 2021 5:28 pm

Hi,

Maybe do it like this?

Code: Select all

Repeat>
  Timer>startTime
  ... do your stuff
  TImer>endTime
  Let>v_waitsecs={85-(%endTime%-%startTime%)/1000)}
  Wait>%v_waitsecs
Until>forever?
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

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