I am having some issues returning the correct coords when using ImageSearch in a game.
The game is running in Window mode, and I have reduced down the resolution from my native resolution (i.e. My desktop is running at 3840x2160, and the game is running in window mode at 1920x1080).
(I have tried running the game in full screen window mode also without success).
ImageSearch is finding the image, but when I use the returned coords with MouseMove, its moves to the wrong location.
I assumed it was due to the CoordMode, but having tried various combinations I have ran out of ideas.
Any ideas would be greatly appreciated, Thanks
Code: Select all
#NoEnv
SetWorkingDir, %A_ScriptDir%
CoordMode, Mouse, Relative
CoordMode, Pixel, Relative
CoordMode, Tooltip, Relative
; Vars
win=mygame
img=band3.png
; Debug
Gui, add, picture, x10 y10, %img%
Gui, show, x100 y10 h70 w250, Hit F2 to Find
return
guiclose:
exitapp
f2::
WinActivate %win%
WinWaitActive, %win%
Sleep, 200
ImageSearch, X, Y, 0, 0, %a_screenwidth%, %a_screenheight%, *50 %img%
if errorlevel=1
{
return
}
else if errorlevel=2
{
MsgBox, Not Found
return
}
MouseMove, X, Y
ToolTip, Found: %X% %Y%
Sleep, 4000
tooltip
return