# Click [v1.0.43+]

Clicks a mouse button at the specified coordinates. It can also hold down a mouse button, turn the mouse wheel, or move the mouse.

Here are examples of common usages (all commas are optional):

Click (by itself) | Clicks the left mouse button once at the mouse cursor's current position.
Click 44, 55 | Clicks the left mouse button once at coordinates 44, 55 (based on CoordMode).
Click right 44, 55 | Same as above but clicks the right mouse button.
Click 2 | Clicks the left mouse button twice at the cursor's current position (i.e. double-click).
Click down | Presses the left mouse button down and holds it.
Click up right | Releases the right mouse button.
Click %x% %y% | Since click does not support expressions, variables should be enclosed in percent signs.

Zero or more of the following items can follow the word Click. Separate each item from the next with at least one space, tab, and/or comma. The items can appear in any order except ClickCount, which must occur somewhere to the right of the coordinates (if coordinates are present).

X, Y: The x/y coordinates to which the mouse cursor is moved prior to clicking. Coordinates are relative to the active window unless CoordMode was used to change that. If omitted, the cursor's current position is used.

Button Name: Left (default), Right, Middle (or just the first letter of each of these); or the fourth or fifth mouse button (X1 or X2), which are supported on Windows 2000/XP or later. NOTE: Unlike MouseClick, the left and right buttons behave consistently across all systems, even if the user has swapped the buttons via the system's control panel.

Mouse Wheel (this has no effect on Windows 9x): Specify WheelUp or WU to turn the wheel upward (away from you); specify WheelDown or WD to turn the wheel downward (toward you). In v1.0.48+, WheelLeft (or WL) or WheelRight (or WR) may also be specified (but they have no effect on older operating systems older than Windows Vista). For ClickCount (below), specify the number of notches to turn the wheel. However, some applications do not obey a ClickCount higher than 1 for the mouse wheel. For them, use a Loop such as the following:

    Loop 5
        Click WheelUp

ClickCount: The number of times to click the mouse (examples: Click 2 ... Click 100, 200, 2). If omitted, the button is clicked once. If coordinates are specified, ClickCount must appear after them. Specify zero (0) to move the mouse without clicking (for example: Click 100, 200, 0).

Down or Up: These words are normally omitted, in which case each click consists of a down-event followed by an up-event. Otherwise, specify Down (or the letter D) to press the mouse button down without releasing it. Later, use the word Up (or the letter U) to release the mouse button.

Relative: The word Rel or Relative treats the specified X and Y coordinates as offsets from the current mouse position. In other words, the cursor will be moved from its current position by X pixels to the right (left if negative) and Y pixels down (up if negative).

#### Remarks

Click is generally preferred over MouseClick because it automatically compensates if the user has swapped the left and right mouse buttons via the system's control panel.

Click uses the sending method set by SendMode. To override this mode for a particular click, use a specific Send command as in this example: SendEvent {Click, 100, 200}

To perform a shift-click or control-click, the Send {Click} method is generally easiest. For example:

    Send +{Click 100, 200}  ; Shift+LeftClick
    Send ^{Click 100, 200, right}  ; Control+RightClick

Unlike Send, Click does not automatically release the modifier keys (Control, Alt, Shift, and Win). For example, if the Control key is currently down, Click would produce a control-click but Send {Click} would produce a normal click.

The SendPlay mode is able to successfully generate mouse events in a broader variety of games than the other modes. In addition, some applications and games may have trouble tracking the mouse if it moves too quickly, in which case SetDefaultMouseSpeed can be used to reduce the speed (but only in SendEvent mode).

The BlockInput command can be used to prevent any physical mouse activity by the user from disrupting the simulated mouse events produced by the mouse commands. However, this is generally not needed for the SendInput and SendPlay modes because they automatically postpone the user's physical mouse activity until afterward.

There is an automatic delay after every click-down and click-up of the mouse (except for SendInput mode and for turning the mouse wheel). Use SetMouseDelay to change the length of the delay.

#### Related

Send {Click}, SendMode, CoordMode, SetDefaultMouseSpeed, SetMouseDelay, MouseClick, MouseClickDrag, MouseMove, ControlClick, BlockInput

#### Examples

    Click  ; Click left mouse button at mouse cursor's current position.
    Click 100, 200  ; Click left mouse button at specified coordinates.
    Click 100, 200, 0  ; Move the mouse without clicking.
    Click 100, 200 right  ; Click the right mouse button.
    Click 2  ; Perform a double-click.
    Click down  ; Presses down the left mouse button and holds it.
    Click up right  ; Releases the right mouse button.