Here's a larger block of the code:
Code: Select all
; Click 300,575
PixelGetColor, Pxcolor, %PsX%, %PsY%
FileAppend, %A_YYYY%-%A_MM%-%A_DD% -------- Color:%Pxcolor% X:%PsX% Y:%PsY%`n, C:\data\ahk-log.txt
if ( Pxcolor < 0xFFFFFF)
MouseMove PsX, PsY
FileAppend, %A_YYYY%-%A_MM%-%A_DD% -------------- Clicked X:%PsX% Y:%PsY%`n, C:\data\ahk-log.txt
PsY := ( PsY - 30)
Currently the numeric value click is commented out, and the iterative search is uncommented.
Basically, I'm trying to click a button. For unknown reasons the button sometimes moves vertically.
The Click 300,575 position is where it is located usually, but not always.
I tried ImageSearch and ImageSearchC to locate the button, but could never get them to work.
My current approach is to loop and move upward by steps of 30 pixels until the button color is found by the PixelGetColor, then click that spot.
In this loop, the mouse does not move to the coordinates, the click has no effect, yet the two FileAppends correctly log the color and coordinates.
I'll try your debugging approach when I have a chance to work on it some more.