Page 1 of 1

PixelSearch help

Posted: 26 Apr 2017, 13:41
by Trigg
What I am trying to do is PixelSearch an orange color, and within the X,Y axis from where my current mouse position is I want it to find a certain color grey within the second PixelSearch coordinates.

Code: Select all

/::
Send, {F3}
Sleep, 150
Send, google{ESC}
Sleep, 100
;first pixel search coords
PixelSearch, Px, Py, 650, 187, 1446, 812, 0x3296FF, 0, Fast
   MouseMove, %Px%, %Py%
Sleep, 100
;2nd pixel search coords
PixelSearch, Px, Py, %Px%, %Py%, 1000, 5, R, 0xE0E0E0, 0, Fast
; Mouse move to the new Px, Py area where the 0xE0E0E0 (grey) color is located.
   MouseMove, %Px%, %Py%
MouseClick, left
;Click that location

Re: PixelSearch help

Posted: 26 Apr 2017, 15:14
by Almost_there
It looks like a working script, but it will probably work too fast so yoy can't track the mouse pointer with your eyes as it mowes toward orange pixel, and almost imediately goes another direction toward the grey pixel.
Furthermore you don't have considered what should happens if one or both color is not found. The mouse pointer would got in upper left corner of your program window if gray color isn't found.

I beleive PixelSearch would ignore fast mode if x1 > x2 or y1 > y2, so the search may take longer time than you expected.