Retrieves the current position of the caret (text insertion point).

CaretFound := CaretGetPos(&OutputVarX, &OutputVarY)


&OutputVarX, &OutputVarY

Type: VarRef

References to the variables in which to store the X and Y coordinates. The retrieved coordinates are relative to the active window's client area unless overridden by using CoordMode or A_CoordModeCaret.

Return Value

Type: Integer (boolean)

If there is no active window or the caret position cannot be determined, the function returns 0 (false) and the output variables are made blank. The function returns 1 (true) if the system returned a caret position, but this does not necessarily mean a caret is visible.


Any of the output variables may be omitted if the corresponding information is not needed.

Note that some windows (e.g. certain versions of MS Word) report the same caret position regardless of its actual position.

CoordMode, A_CoordModeCaret


Allows the user to move the caret around to see its current position displayed in an auto-update tooltip.

SetTimer WatchCaret, 100
WatchCaret() {
    if CaretGetPos(&x, &y)
        ToolTip "X" x " Y" y, x, y - 20
        ToolTip "No caret"