Function Reference


MouseGetPos

Retrieves the current position of the mouse cursor.

MouseGetPos ( [dimension] )

Parameters

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.

Remarks

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

Related

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

Example

#include <MsgBoxConstants.au3>

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