Coordinates

Many commands and functions (lef, rig, mid, dou, mou, win, child, pixel, mov, siz, wait) use coordinates x and y to specify a point in the screen or a window.

 

With mouse commands, pixel and wait, if window is omitted or 0 (constant), coordinates are relative to the top-left corner of the screen or the work area. Otherwise, they are relative to the window or to the client area of the window. Window's client area includes all except border, caption bar, scroll bars and standard menu bar. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars.

 

If coordinates are integer values, they are interpreted as number of pixels. A pixel is the smallest unit that can be displayed on a monitor. It depends on screen resolution. For example, resolution of 1024x768 means 1024 pixels in horizontal and 768 pixels in vertical. When you move the mouse, in the QM status bar you can see mouse pointer coordinates in pixels. The status bar shows mouse coordinates relative to the screen and relative to the window. If Options\Record\Client is checked, the status bar shows client coordinates.

 

If coordinates have type of double (usually from 0.0 to 0.999) then they are interpreted as fraction of the screen, window, client area or child window. For example, mou 0.5 0.5 child("OK" "Button" "Message") moves the mouse to the middle of OK button. If Options\Record\Fraction is checked, the status bar shows fractional coordinates. Double coordinates cannot be used with user-defined and dll functions.

 

Usually screen coordinates must be relative to the primary monitor. If you want to use coordinates relative to some other monitor, use function XyMonitorToNormal to convert them.