;EXAMPLES Pixelsearch
;Here are two possible ways of waiting for a color onscreen:
While (color <> 0x031323)
{
PixelGetColor, color, 801,1194
sleep, 300
}
;This code is best if the color never varies and the location never varies.
;It will move past the loop once the color is found in the specific location.
return
Loop
{
PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0x031323, 10
if !ErrorLevel
break
sleep, 300
}
;This code is best if the location changes and the color has variance.
;The x and y coordinates of the color will be in variables x,y when it is found.
;Allowed variation in the color is the parameter after the color in PixelSearch.
;Note the x and y returned should be relative to the active window.
;if this is not suitable, you can use the CoordMode command to change it to be relative to the screen.
;return
;----
;For clicking, you said you already found it but here's a method anyway:
Click down %x% %y%
Sleep, 1000 ;-hold for one second
Click up
return
;----
;To monitor if a certain color appears (or doesn't appear) in a spot at any time in the life of the script:
SetTimer, ColorCheck, 300 ;- the last parameter is # of milliseconds between checks
Loop
{
;application code here...
}
ColorCheck:
PixelGetColor, color, x,y ;- fill in x,y coordinates
if (color <> 0x000000) ;- fill in 0x...
Reload ;start over
return
PixelSearch, Px, Py, 200, 200, 300, 300, 0x9d6346, 3, Fast
if ErrorLevel
MsgBox, Color not found.
else
MsgBox, Found color with 3-ColorNuances at X%Px% Y%Py% .
return