Function Reference


Retrieves the current position of the mouse cursor.

MouseGetPos ( [dimension] )


dimension [optional] argument that determines what the return value will be. See Return Value.

Return Value

Dimension Values
None Returns a two-element array containing the mouse coordinates: $aArray[0] = X coord (horizontal), $aArray[1] = Y coord (vertical)
0 Returns the X co-ordinate as an integer.
1 Returns the Y co-ordinate as an integer.
If dimension is not a number @error will be set to 1.


See MouseCoordMode for relative/absolute position settings. If relative positioning, numbers may be negative.


MouseClick(), MouseClickDrag(), MouseCoordMode (Option), MouseDown(), MouseGetCursor(), MouseMove(), MouseUp(), MouseWheel(), PixelGetColor()


#include <MsgBoxConstants.au3>

Local $aPos = MouseGetPos()
MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1])