The problem is that they are random, it is not always the same the first one, how would you write that in the code? Because for example if I use this code
Code: Select all
^h::
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 0, 0, 1440, 900, C:\Users\Anon\Downloads\Arrows\down.png
if (ErrorLevel = 2)
MsgBox Image not found.
else if (ErrorLevel = 1)
MsgBox Image not found.
else
Send {down}
Return
ImageSearch, FoundX, FoundY, 0, 0, 1440, 900, C:\Users\Anon\Downloads\Arrows\down.png
if (ErrorLevel = 2)
MsgBox Image not found.
else if (ErrorLevel = 1)
MsgBox Image not found.
else
Send {up}
Return
There is what I am looking for, I want them to be pressed in order, because without the order the sequence is canceled.
Edit. I have tried this code as well, but it seems that it does the search in this order: up, down, left, right (and it is not what I am looking for, I need it to recognize the images in order from left to right)
Code: Select all
^h::
CoordMode, Pixel, Window ; Interprets the coordinates below as relative to the screen rather than the active window.
For index, direction in ["Up", "Down", "Left", "Right"] {
ImageSearch,,, 0, 0, 1440, 900, C:\Users\Anon\Downloads\Arrows\%direction%.png
If !ErrorLevel {
Send {%direction%}
Break
}
}