The title of the window to access.
Optional text found in the window.
The control to interact with.
The mouse button to click. Default is MouseButton.Left
.
The number of times to click the mouse. Default is 1.
The x position to click within the control. Default is the center.
The y position to click within the control. Default is the center.
1 if success, 0 if failed.
import { ControlClick } from '@ahmic/autoit-js';
// Click the Notepad window's edit control.
ControlClick('Untitled - Notepad', '', 'Edit1');
// Right click the Notepad window's edit control.
ControlClick('Untitled - Notepad', '', 'Edit1', MouseButton.Right);
// Double click the Notepad window's edit control.
ControlClick('Untitled - Notepad', '', 'Edit1', MouseButton.Left, 2);
Simulates a mouse click on a control. Unlike
MouseClick
,ControlClick
won't move the mouse cursor but is capable of clicking on controls that may be obscured by other windows.Where possible, you should prefer using
ControlClickByHandle
to avoid potential issues with ambiguous window and control titles.