Get point color

Syntax

int pixel(x y [window] [flags])

 

Parts

x and y - coordinates.

window - top-level or child window. If omitted or 0 (constant), x and y are screen coordinates.

flags - combination of the following values. Default: 0.

1 coordinates are relative to the top-left corner of window's client area or, if window is 0 (constant), of the work area.
2 when window is used, don't activate the window and don't generate error if the specified point does not belog to it.

 

Remarks

Returns the color of the specified pixel on the screen.

 

If window is inactive, activates it, unless flag 2 is used. If window does not exist, or is hidden, or point is outside window, generates run-time error. If window is child, point can be outside, but must be inside parent window.

 

See also: wait, scan.

 

Examples

int col = pixel(300 35 "Quick Macros")
int r g b
ColorToRGB(col &r &g &b)

 Store color from mouse pointer into the clipboard:
str s.format("0x%X" pixel(xm ym))
s.setclip