Home > Language Reference > Windows Management Functions > ClickOnBitmap


The ClickOnBitmap function simulates a mouse button click on the specified image (or near it).


Mainly used to click icons on a toolbar when the icon has no label, or to click an icon representing a button. Use ClickOnBitmap function only if no other functions can achieve the click as bitmaps rely on screen resolution. For example, if the icon on toolbar calls directly a menu option, prefer to automate the menu option instead of the icon click.

Video: How to use Clickonbitmap to click an icon without any text (and not exposed to UI Automation technology - only WinTask x64 supports UI Automation technology).


ret=ClickOnBitmap(<bmp_filename>, left|right,single|double [, InArea(<x>,<y>,<height>,<width>)] [, <offset_x>,<offset_y>])


<bmp_filename>, string, name of the bmp file representing the image where to click. 

left|right, keyword, type of mouse button to click.

single|double, keyword indicating the click action.

InArea, optional keyword to specify that the image must be searched only within the specified area.

<x>,<y>, integer, coordinates of the topleft point of the area.

<height>,<width>, integer, size of the area.

<offset_x>,<offset_y>, optional integers specifying an offset distance for the click. If not specified, the click is done on the middle of the image.

Return value

ret, optional numeric return value. If the function succeeds, the return value is 0. The return value is 1 if the .BMP is not present on disk, 5 if the bitmap is in wrong color depth and 8 if the matching bitmap is not found on the screen. Error 22 means that the window where the bitmap has to be clicked is not there anymore at execution of ClickOnBitmap line.

Script execution does NOT stop in case of an error while executing ClickOnBitmap.


Generate the ClickOnBitmap syntax using its wizard: in the Language pane of the WinTask x64 Editor, double-click the ClickOnBitmap function name to start the wizard (if the Language pane is not displayed, press F4 or select Insert/Statement menu).

#BitmapPrecision system variable specifies how closely the found image must match the input image. The default value is 100 which means exact match.

See also