Yes, if you look at the help file for
FindImagePos you'll see it says :
"
Each method has benefits and drawbacks. CCOEFF is more intelligent and more tolerant but is slower and will return only one match. EXACT is faster and can return multiple matches but is precise and therefore less portable and will not cope with changes."
So using EXACT, you will see that NumFound may be more than 1. In your first screenshot, the image appears twice, and in the second we see it seven times. So we'd expect Numfound to be 2 and 7 respectively.
There's a curved ball though. On screenshot 2, while the image itself may be the same, the background isn't. The table alternates between grey and white. So we have to take that into consideration and start adjusting our tolerances in the hope of finding the sweet spot.
I found that using CCOEFF, it only ever found whichever variation I sampled - grey or white - even if I gave it a tolerance of 1 or 0.1 - the least sensitive. But of course CCOEFF will only ever find 1 match - the most likely candidate.
After experimenting with EXACT, I found a tolerance of 19 always returned NumFound 7. So it successfully ignores the colour difference while finding all the icons.
So if we want to click on, for example, the third icon, we use the appropriate value in the XArr YArr arrays. With 0 being the first match, 1 the second, 2 the third, and so on.
Code: Select all
//Move mouse to first match..
FindImagePos>%BMP_DIR%\image_7.bmp,SCREEN,19,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
MouseMove>XArr_0,YArr_0
Endif
Code: Select all
//Move mouse to third match..
FindImagePos>%BMP_DIR%\image_7.bmp,SCREEN,19,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
MouseMove>XArr_2,YArr_2
Endif
One more thing to note is that using EXACT with a tolerance on your entire screen may be very resource hungry. So maybe try to reduce that overhead by making it look within a known rectangle on the screen. When using the wizard under the "Where to look" tab, click "Search Within this rectangle", click Draw, then select your area.