Method Reference (COM)

PixelSearch

Searches a rectangle of pixels for the pixel color provided.

PixelSearch left, top, right, bottom, color [, shade-variation] [, step]]

 

Parameters

left left coordinate of rectangle.
top top coordinate of rectangle.
right right coordinate of rectangle.
bottom bottom coordinate of rectangle.
colour Colour value of pixel to find (in decimal or hex).
shade-variation [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match).
step [optional] Instead of searching each pixel use a value larger than 1 to skip pixels (for speed). E.g. A value of 2 will only check every other pixel. Default is 1.

 

Return Value

Success: Returns a string containing the pixel's coordinates in the format "x,y"
Failure: Sets oAutoIt.error to 1 if color is not found.

 

Remarks

The search is performed top-to-bottom, left-to-right, and the first match is returned.

Earlier versions of AutoIt (prior to v3.0.102) used the BGR format for defining color - newer versions use RGB by default but this can be changed using the ColorMode option.

Performing a search of a region can be time consuming, so use the smallest region you are able to reduce CPU load.

 

Related

ColorMode (Option), PixelChecksum, PixelGetColor, PixelCoordMode (Option)

 

Example