Home > Language Reference > Windows Management Functions > ClickMouse


The ClickMouse function simulates a mouse button click at the specified coordinates.


ClickMouse function should be used only if a control within the application cannot be clicked using Click function or SendKeys function (for sending a keyboard shortcut). ClickMouse function is pixel related and dependent on screen resolution.


ClickMouse(left|right|middle, down|up|double, <x>, <y> [, absolute])


left|right|middle, keyword, type of the mouse button to click. Midlle keyword is not generated by Recording mode.

down|up|double, keyword indicating the click action.

<x>,<y>, integer, coordinates of the pixel to click, relative to the topleft point of the current window (unless absolute keyword is specified).

absolute, optional keyword.  If absolute keyword is specified, <x>,<y> are relative to the topleft point of the full screen.

Return value



UseWindow statement is needed before a ClickMouse statement, the click is done within this window. If no window is specified previously by a UseWindow statement, an error message is displayed and script execution stops (unless #IgnoreErrors=1).

When a single click is recorded, two statements are generated :
If you have in a script just one ClickMouse line with Down or Up second parameter, the mouse is in an unstable status and subsequent lines will not replay correctly.

See also



'Launch notepad
'Type some text
UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)
 SendKeys("ClickMouse Test")
'Click somewhere within the text using Left button
'Click somewhere within the text using Right button - it opens the context menu, select Undo option in the context menu