CoordMode

Sets coordinate mode for various built-in functions to be relative to either the active window or the screen.

PrevRelativeTo := CoordMode(TargetType , RelativeTo)

Parameters

TargetType

Type: String

Specify one of the following words to indicate the type of target to affect:

ToolTip: Affects ToolTip.

Pixel: Affects PixelGetColor, PixelSearch, and ImageSearch.

Mouse: Affects MouseGetPos, Click, MouseMove, MouseClick, and MouseClickDrag.

Caret: Affects CaretGetPos.

Menu: Affects the Menu.Show method when coordinates are specified for it.

RelativeTo

Type: String

If omitted, it defaults to Screen. Otherwise, specify the area that TargetType should be relative to:

Screen: Coordinates are relative to the desktop (entire screen).

Window: Coordinates are relative to the active window.

Client: Coordinates are relative to the active window's client area, which excludes the window's title bar, menu (if it has a standard one) and borders. Client coordinates are less dependent on OS version and theme.

Return Value

Type: String

This function returns the area that TargetType was previously relative to.

Remarks

By default, coordinates are relative to the active window's client area. This applies to all built-in functions that use coordinates, except those documented otherwise (e.g. WinMove and InputBox).

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this function. That default may be changed by using this function during script startup.

The built-in A_CoordMode variables contain the current settings and can also be assigned a new value instead of calling CoordMode.

Click, MouseMove, MouseClick, MouseClickDrag, MouseGetPos, PixelGetColor, PixelSearch, ToolTip, Menu.Show

Examples

Places tooltips at absolute screen coordinates.

CoordMode "ToolTip", "Screen"

Same effect as the above because "Screen" is the default.

CoordMode "ToolTip"