By using this site you agree to the use of cookies.

Learn more

AutoIt MouseCoordMode Option

How to use the MouseCoordMode Option to change

Edited: 2017-02-07 14:28

The AutoIt MouseCoordMode option controls the way coords should be used, and can be set either relative to the active window, or as absolute screen coordinates.

Use Opt to change the MouseCoordMode, simply place the below in your script where you want the setting to change:

Opt("MouseCoordMode", 1)

To change to relative coordinates for the active window, simply change the 1 to a 0.

When using 0 for the active window, the coords will work relative to the edges of the window, including the borders and title bar. If instead you use 2 for the client area, the title bar and borders will be excluded.

It's a good idea to use relative coords, so your script will continue to work even when the window is moved. Once the setting is changed, it will stay until you change it again later in your script.

When using 2, it seems the coordinates will be relative bottom left, instead of top left, which may not be desired.

Some programs do not have a visible title bar (web browsers). Further more, the client area of web browsers appears to include everything, including the tabs and bookmarks bar (if present).

Web Browsers

People might be looking at MouseCoordMode when automating web browsers. This option likely won't do what you are looking for, since the client area includes more than expected by some.

When automating browser windows, due to unexpected behavior of the client area option, it may be better to open a browser window without the normal UI elements, such as address bar and bookmarks bar.

Opening a minimal browser window can be done by adding a parameter to the browser shortcut, or by opening the browser via the Windows run dialog (Win + R). You may also want to check the documentation of the browser you want to automate.

iexplore.exe -k
chrome.exe --app=

For FireFox there is an add-on that disables the address bar.

Finally you also have the option of using a portable browser, which is modified to suit your own needs. In some circumstances this might also be better than using the users own browser.

Possible Values

0Relative coordinates to the active window
1Absolute screen coordinates (default)
2Relative coordinates to the client area of the active window


  1. MouseCoordMode -