//Wait for
WaitScreenImage>%BMP_DIR%\image_2.bmp,0.6,CCOEFF
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
i want to repeat till there is no more same FIndimage POs
How to repeat this code until there is no more same image
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 5
- Joined: Sun Jun 14, 2020 4:06 pm
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Re: How to repeat this code until there is no more same image
You can do that with While/EndWhile, so the code will keep looping until a certain condition is met. If the image is visible and found by FindImagePos, NumFound will be 1. So we can keep looping until it is no longer 1. Note that we set NumFound to 1 before the While/Endwhile loop to ensure the condition is met for the first cycle.
Code: Select all
//Wait for
WaitScreenImage>%BMP_DIR%\image_2.bmp,0.6,CCOEFF
Let>NumFound=1
While>NumFound>0
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
Endwhile
//You can delete this
mdl>It's not there now