Browse the docs

mouseButton

Returns 1 while a mouse button is held down, 0 otherwise.

Keyboard Maestro: MOUSEBUTTON

Details #

mouseButton() and mouseButton(button) take zero or one argument and return 1 when the button is held down right now, otherwise 0.

button is a number: 1 is the left button (also used when you leave it out), 2 the right button, and 3 or higher the middle button.

Parameters #

Takes 0 to 1 argument. {{ mouseButton(text?) }}

Examples #

mouseButton()
→ 0
mouseButton(2)
→ 0

Gotchas #

  • A button number that isn't a number counts as 1, the left button.

  • It reports the button at the moment the step runs, so it is 0 by the time a click-triggered macro asks about a click that has finished.

  • With no real system behind it, it returns 0.