Method Reference
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. |
color | color 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 color. 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 2 element array containing the pixel's coordinates |
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.
Performing a search of a region can be time consuming, so use the smallest region you are able to reduce CPU load.
Related
PixelChecksum, PixelCoordMode (Option), PixelGetColor
Example
Set oAutoIt = WScript.CreateObject("AutoItX3.Control") value = oAutoIt.PixelSearch(0,0, 100, 100, 0) If oAutoIt.error = 1 Then WScript.Echo "Color not found" Else WScript.Echo "Color found at: " & value(0) & "," & value(1) End If