Searches a rectangle of pixels for the pixel color provided.
PixelSearch ( left, top, right, bottom, color [, shade-variation = 0 [, step = 1 [, hwnd]]] )
The search direction varies as follows:
Left-to-Right - left < right
Right-to-Left - right < left
Top-to-Bottom - top < bottom
Bottom-to-Top - bottom < top
Changing the search direction can be a useful optimization if the color being searched for frequently appears in a specific quadrant of the search area since less searching is done if the search starts in the most common quadrant.
Remember, a typical display at 1024 x 768 has 786432 pixels. Although PixelSearch() is optimized, narrowing the search area helps speed up the result.
If PixelCoordMode is set to its default SCREEN (1) mode the hwnd parameter is ignored. Only if PixelCoordMode is set to WINDOW (0) or CLIENT (2) will it be honoured.
PixelChecksum, PixelCoordMode (Option), PixelGetColor
#include <MsgBoxConstants.au3>
; Find a pure red pixel in the range 0,0-20,300
Local $aCoord= PixelSearch (0,0,20,300,0xFF0000)
If Not @error Then
MsgBox ($MB_SYSTEMMODAL,"","X and Y are: "&$aCoord[0]&","&$aCoord[1])
EndIf
; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$aCoord= PixelSearch (0,0,20,300,0xFF0000,10)
If Not @error Then
MsgBox ($MB_SYSTEMMODAL,"","X and Y are: "&$aCoord[0]&","&$aCoord[1])
EndIf