ImageSearch Persistent ErrorCode=2
Posted: 19 Sep 2019, 21:46
Hello everyone!
New to AutoHotkey and I cannot figure out what I am doing wrong here. From the ToolTip it is clear that I have 4 numbers that should work for Image Search, but the ErrorLevel is always 2.
The image file is in the same directory as the script. If anyone has a suggestion to fix this code (or even to clean it up) that would be fantastic!
Cheers!
-S
New to AutoHotkey and I cannot figure out what I am doing wrong here. From the ToolTip it is clear that I have 4 numbers that should work for Image Search, but the ErrorLevel is always 2.
Code: Select all
MouseX:=non
MouseY:=non
TopLeftX:=non
TopLeftY:=non
BottomRightX:=non
BottomRightY:=non
#Persistent
SetTimer, WatchCursor, 100
return
WatchCursor:
MouseGetPos, MouseX, MouseY
TopLeftX := MouseX-100
TopLeftY := MouseY+200
BottomRightX := MouseX+100
BottomRightY := MouseY
ImageSearch, OPX, OPY, %TopLeftX%, %TopLeftY%, %BottomRightX%, %BottomRightY%, Image.JPG
test=%ErrorLevel%
ToolTip, %TopLeftX% %TopLeftY% %BottomRightX% %BottomRightX% %ErrorLevel%
Cheers!
-S