MouseGetPos
From AutoIt Wiki
Retrieves the current position of the mouse cursor as an array or integer.
Contents |
Syntax
MouseGetPos ( [dimension] )
Parameters
| dimension | An optional argument that determines what the return value will be. See Return Value. |
Dimension
If dimension is not a number @error will be set to 1.
Return Value
| Dimension | Values |
| None | Returns a two-element array that containing the mouse coordinates: $array[0] = X coord (horizontal), $array[1] = Y coord (vertical) |
| 0 | Returns the X co-ordinate as an integer. |
| 1 | Returns the Y co-ordinate as an integer. |
Example
$pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])
Remarks
See MouseCoordMode for relative/absolute position settings. If relative positioning, numbers may be negative.
Related Functions
MouseClick, MouseClickDrag, MouseMove, MouseCoordMode (Option)