If you mean act when distance difference is less than 30 ( or you want color values difference....it is a bit ambigous)
example tooltip is ok when mouse is within 30 pixels of screen center.
Code: Select all
#Persistent
p1x:=a_screenwidth//2
p1y:=a_screenheight//2
coordmode,mouse
CoordMode, pixel
SetTimer, alert,250
return
alert:
mousegetpos,p2x,p2y
if (Abs(p1x-p2x)<30 and Abs(p1y-p2y)<30)
tooltip ok
else
tooltip out of range
return
esc::exitapp
Code: Select all
Pixelsearch, p1x,py1,0,0,500,500,color1,20,rgb
if errorlevel
{
msgbox not found
return
}
else
Pixelsearch, p2x,py2,0,0,500,500,color2,20,rgb
if errorlevel
{
msgbox not found
return
}
else if (Abs(px1-px2)<30 and Abs(py1-py2)<30)
tooltip ok
else
tooltip out of range
return