You have the mouseclick before the mousemove so it's clicking first then landing on the image
I don't know what %FoundX1%,%FoundY1% mean but I assume this is what you are trying to do
Code: Select all
{
MouseGetPos, xpos, ypos
;MouseGetPos,,, WinUMID I am not sure what this line is for but I think it might overwrite the last one
sleep 200
Mousemove, %xpos%, %ypos% ;will move mouse first
sleep 200
MouseClick ;will single click
sleep 200
WinActivate, ahk_id %WinUMID%
sleep 2000
}
if this is not what you are trying to do we need to see the imagesearch code to see what else might be going wrong. (I'll guess that %FoundX1%,%FoundY1% are the results of your imagesearch?) If it's finding the target though then the problem has to be with the MouseClick. I personally always use image search like this. It could be you're not giving it enough of a sleep to actually be on top of the image before it clicks. To be absolutely sure use a very large number like 5000 as a test
Code: Select all
MouseMove, ImageFoundX, ImageFoundY
sleep 5000
MouseClick
;not sure why but I always do it this way ^ instead of this way v
;might be that the bottom way has caused problems for me in the past
MouseClick, right, ImageFoundX, ImageFoundY