sendMouseEvent()
The function sends a mouse event to a target window.
Synopsis
int sendMouseEvent(string|shape target, int x = -1, int y = -1, int button =
0, int modifiers = 0);
Parameters
Parameter | Description |
---|---|
target |
|
x, y |
Mouse coordinates relative to the given target Default is the current mouse position |
button | The mouse-button to be pressed. Can be MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE, or empty string for release. |
modifiers | a combination of KEY_SHIFT, KEY_CONTROL, KEY_ALT, KEY_META |
Return value
Returns -1 if an error occurs and 0 if the function was executed successfully.
Errors
The specified module does not exist.
Description
The function sends a mouse event to a target. It specifies the position the mouse pointer has and the button that is pressed. Passing an empty string to the "button" parameter creates a release of the mouse button.
Therefore a mouse click consists of two calls of this function: a press followed by a release.
Example
Sending a mouse click to a panel
main()
{
sendMouseEvent(panel, 395, 100, MOUSE_LEFT);
sendMouseEvent(panel, 395, 100);
}
Assignment
Miscellaneous Functions
Availability
UI