I was trying to write a script to click generate button on this random number page until the number is 55.
So I pressed alt print screen to capture screen and crop image with paint then save it as .jpg.
I use window spy to find the position for checking image. The number from window spy that I used is from Window: xxx,xxx (default) under Mouse Position.
But nothing happens when the number is 55. Need help.
Thank you in advance.
Below is my code.
Code: Select all
^+H::
loop {
ImageSearch, Pos1, Pos2, 948, 346, 1121, 537, D:\number.jpg
if (ErrorLevel = 0) {
MsgBox Image is found!!!!
Break
}
else if (ErrorLevel = 2) {
MsgBox Could not conduct the search.
Break
}
else {
Click 990, 455 ; position of generate number button
sleep 3000
}
}
return
Esc:: ExitApp