ClickOnBitmap
Windows management function.
The ClickOnBitmap function simulates a click on the specified image (or near the specified image).
Usage
Mainly used to click icons which are images and not standard Windows icons. For example, a Cancel button is not a standard Cancel button as in any notepad dialog boxes, but a nice Cancel button with a cross. For such a button which is in fact a bitmap, use ClickOnBitmap function and its wizard for automatizing the click.
Syntax
ClickOnBitmap(<filename.BMP>,<button>,<action>[,InArea(<x>,<y>,<height>,<width>)[,<offset_x>,<offset_y>]]
or
ret=ClickOnBitmap(<filename.BMP>,<button>,<action>[,InArea(<x>,<y>,<height>,<width>)[,<offset_x>,<offset_y>]]
Parameters
<filename.BMP>, the mouse click is executed using the image stored in the specified file (extension .BMP). During the time delay specified by #ActionTimeout, WinTask tries to find and click this image within the window specified by the last UseWindow statement. You must specify the UseWindow function just before the ClickOnBitmap. If the image is not found, no error is generated and the script continues.
<Button>, mouse button used to click the image, the keywords are Left or Right.
<Action> : single or double click.
InArea : optional keyword to indicate that the image must be searched for only within the specified area.
<x>,<y> : coordinates of the top-left corner of the area in which to look for the image.
<height>,<width> : integers specifying the height and the width of the area in which to look for the image.
<offset_x>,<offset_y>, optional parameters : coordinates of the click offset from the middle of the specified image. If these values are 0, the click occurs in the middle of the image.
Return value
Ret, numeric return code. When successful, the function returns 0. Return code 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.
Remarks
This function can be used when standard functions (such as ChooseItem) cannot click the proper item (non-standard Windows applications).
Use the Insert/Statement menu and select ClickOnBitmap in order to automatically generate this statement.
Be aware that the generated .BMP file depends on how many colors have been configured in the video settings.
See also
Is there a new mail, this script example shows how to use ClickOnBitmap for testing if a bitmap is present or not.
Example
UseWindow(...)
ClickOnBitmap("C:\save\image.bmp",Left,Single,-10,50)