Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Click

The km.click([button]) command is used to make the mouse press and release a button over some time.

By replacing button with the number representing a button as shown below, this command can be used for all buttons.

Currently this command presses, delays, releases, delays, and then returns to the hardware state.

There is a delay for how long the press and release are held for. The press and release durations are uniformly random values between 75ms and 125ms, and 125ms and 175ms respectively. For fine control over the duration of the delays, I strongly recommend developers use the commands defined in Set Button State.

Clicks can be overridden by the user via the Hardware Override.

If the button is physically pressed when the click starts, it will be force released after the press delay, and then the release will be removed after the release delay, putting it back in the hardware state (pressed if it’s still physically pressed, or released if the user released the button at some point).

Buttons
Button NumberButton Description
0the left button
1the right button
2the scroll wheel button
3the rear side button
4the front side button

Examples

Clicking the Left Button

Input:

km.click(0)  # 0 for Left

Output:

km.click(0)
>>>

Clicking the Front Side Button

Input:

km.click(4)  # 4 for Front Side

Output:

km.click(4)
>>>