Moves the mouse cursor.
|MouseMove, X, Y [, Speed, R]|
|X, Y||The x/y coordinates to move the mouse to, which can be expressions. Coordinates are relative to the active window unless CoordMode was used to change that.|
|Speed||The speed to move the mouse in the range 0 (fastest) to 100 (slowest), which can be an expression. Note: a speed of 0 will move the mouse instantly. If omitted, the default speed (as set by SetDefaultMouseSpeed or 2 otherwise) will be used.|
|R||If this parameter is the letter R, the X and Y coordinates will be treated 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).|
Some applications such as certain full-screen games may have trouble tracking the mouse if it moves too quickly. The speed parameter or SetDefaultMouseSpeed can be used to reduce the speed.
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.
There is an automatic delay after every movement of the mouse. Use SetMouseDelay to change the length of the delay.
The following is an alternate way to move the mouse cursor:
DllCall("SetCursorPos", int, 100, int, 400) ; The first number is the X-coordinate and the second is the Y (relative to the screen).
CoordMode, SetDefaultMouseSpeed, SetMouseDelay, MouseClick, MouseClickDrag, MouseGetPos, BlockInput
; Move the mouse to a new position: MouseMove, 200, 100 ; Move the mouse slowly (speed 50 vs. 2) by 20 pixels to the right and 30 pixels down ; from its current location: MouseMove, 20, 30, 50, R