im having an issue with the following code:
Code: Select all
f1::
{
mousegetpos, start_x, start_y
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, D:\test.bmp
if (ErrorLevel = 2)
MsgBox Could not conduct the search.
else if (ErrorLevel = 1)
MsgBox Icon could not be found on the screen.
else
PosX:=FoundX+10
PosY:=FoundY+10
mouseclick, left, %PosX%, %PosY%
mousemove, %start_x%, %start_y%
mousegetpos, end_x, end_y
MsgBox start pos at %start_x%x%start_y%. End pos at %end_x%x%end_y%.
}
return
1) Remember the current postion of the mouse
2) Find a specific icon on the screen
3) Click 10 pixels right, and 10 pixels below the top left pixel of that icon
4) Return the mouse to the position it was before
Everything up to point #4 works as it should, however my mouse does not end on its starting position. This is why i added MsgBoxes which print the starting and end positions of the mouse.
Here is the screenshot:
https ibb.co /TT0HQTJ Broken Link for safety
I suspect it has something to do with Coord Mouse, but i wasnt able to find a solution...
Thanks in advance
EDIT:
The problem is definitely multiple monitors, when i disable everything but my main one, the script works fine. But with more than 1 monitor even the
Code: Select all
CoordMode, Mouse, Screen
f1::
{
MouseGetPos, PosX, PosY
mousemove, 100, 100
sleep 200
MouseMove, %PosX%, %PosY%
}
return