AutoHotkey – Click
Performs click(s) at a specified location. (x, y coordinates)
Parameters
Click[, Options]
Specify zero or more parameters, and separate them with space/tab/comma.
The parameters can appear in any order, except ClickCount.
If ClickCount is present it must be the least used parameter.
- Coords: the X and Y coordination, the default CoordMode is set to Window by default so the coordinates are relative to the active window
- WhichButton: use one of the followings: Left, Right, Middle, X1 (fourth button), X2 (fifth button), or L, R, M, can be omitted, in this way Left button will be used
- ClickCount: the number of times the click happens, if omitted 1 click will happen
- DownOrUp: Down will hold down the button, and Up will release it. O, D can be used.
- Relative: Rel or Relative keywords change the coordinate mode to a relative, the coordinates will mean relative coordinates.
Examples
Perform a single left click
Click, 1
; Click, L
; Click, Left
; Click, Left, 1
Perform a single right click
Click, R
Double click (left)
Click, 2
Perform multiple clicks with a variable
clicks := 10
click, %clicks%
Click at the bottom-right of the screen, then at the top-left. And switch back the CoordMode to the previous mode.
CurrentMouseMode := A_coordModeMouse
CoordMode, Mouse, screen
Click, 1800, 50
Sleep, 100
Click, 50, 50
CoordMode, Mouse, % CurrentMouseMode