WhichButton can also be WheelUp or WU to turn the wheel upward (away from you), or WheelDown or WD to turn the wheel downward (toward you). 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. For example, Click, Right clicks the right mouse button at the mouse cursor's current position. WhichButton: Left (default), Right, Middle (or just the first letter of each of these) or the fourth or fifth mouse button (X1 or X2).
If omitted, the cursor's current position is used. Coordinates are relative to the active window unless CoordMode was used to change that. For example, Click, 100 200 clicks the left mouse button at a specific position. The components can appear in any order except ClickCount, which must occur somewhere to the right of Coords, if present.Ĭoords: The X and Y coordinates to which the mouse cursor is moved prior to clicking. Separate each component from the next with at least one space, tab, and/or comma. Specify zero or more of the following components: Coords, WhichButton, ClickCount, DownOrUp, and/or Relative. It can also hold down a mouse button, turn the mouse wheel, or move the mouse. Use SetMouseDelay to change the length of the delay.Click - Syntax & Usage | AutoHotkey Click Ĭlicks a mouse button at the specified coordinates. This delay also occurs after the movement of the mouse during the drag operation. There is an automatic delay after every click-down and click-up of the mouse (except for SendInput mode). However, this is generally not needed for the SendInput/Play modes because they automatically postpone the user's physical mouse activity until afterward. 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.
The speed parameter or SetDefaultMouseSpeed can be used to reduce the speed (in the default SendEvent mode only). Some applications and games may have trouble tracking the mouse if it moves too quickly. However, dragging via SendPlay might not work in RichEdit controls (and possibly others) such as those of WordPad and Metapad. The SendPlay mode is able to successfully generate mouse events in a broader variety of games than the other modes. To visually move the mouse more slowly - such as a script that performs a demonstration for an audience - use SendEvent Īnother advantage of the method above is that unlike MouseClickDrag, it automatically compensates when the user has swapped the left and right mouse buttons via the system's control panel. Speed is ignored for SendInput/Play modes they move the mouse instantaneously (though SetMouseDelay has a mode that applies to SendPlay). If omitted, the default speed (as set by SetDefaultMouseSpeed or 2 otherwise) will be used. Note: A speed of 0 will move the mouse instantly. The speed to move the mouse in the range 0 (fastest) to 100 (slowest), which can be an expression. The x/y coordinates to drag the mouse to (that is, while the button is held down), which can be expressions. If omitted, the mouse's current position is used. The x/y coordinates of the drag's starting position, which can be expressions (the mouse will be moved to these coordinates right before the drag is started). To compensate automatically for cases where the user has swapped the left and right mouse buttons via the system's control panel, use the Click command instead. Specify X1 for the fourth button and X2 for the fifth. The button to click: Left, Right, Middle (or just the first letter of each of these). MouseClickDrag, WhichButton, X1, Y1, X2, Y2, Speed, Relative Parameters WhichButton
MouseClickDrag - Syntax & Usage | AutoHotkey MouseClickDragĬlicks and holds the specified mouse button, moves the mouse to the destination coordinates, then releases the button.