Question for Imagesearch expert
My understanding is it does not keep searching after a match. Yeah, the documentation isn't very clear. Maybe it'd be better worded "If there are multiple areas on the screen that could be a match, only the first one is found and the search ends." I believe it to only search until one match because otherwise the command might have natively supported reporting back multiple matches. (Though I get the logistics of that might be tricky cause it might report hundreds of matches in the same little area due to variation tolerances; if you were to omit any matches that overlap a previously identified match, then people who wanted overlaps would complain about that.)
BTW, you are free to use A_ScreenWidth and A_ScreenHeight just as you used them above for the X2 and Y2 coordinates if you'd like.
Yes, it only finds the 1st one, or at least it only returns the first image found.
If you want the second one you can find the first one, then do a second search, starting 1 pixel after (on the x-axis) you fist result which will find the next one.
If you want the 2nd last one, you will have to count the number of images with a counter increasing for each found image. Then take you total number, subtract one to get the nth image and search that many times.
Interesting, I did a test looking for a image that should be found faster (top left) of the screen and timed that (93ms best time) then did a search for something at the bottom right and the best time I got was faster (78ms best time). The average times were longer for the second one but maybe my use of "A_TickCount" was not correct. Might also be something to do with the detail in the images that I was looking for. I just used a bit of code I had from a last project.