Function Reference

AutoItSetOption

Changes the operation of various AutoIt functions/parameters.

AutoItSetOption ( "option", param )

 

Parameters

option The option to change. See Remarks.
param The parameter (varies by option). See Remarks.

 

Return Value

Returns the value of the previous setting.

 

Remarks

You may use Opt() as an alternative to AutoItSetOption().

AutoIt will halt with an error message if the requested option is unknown. Options are as follows:
Option Param
CaretCoordMode Sets the way coords are used in the caret functions, either absolute coords or coords relative to the current active window:
0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window
ColorMode Sets the way colors are defined, either RGB or BGR. RGB is the default but in previous versions of AutoIt (pre 3.0.102) BGR was the default:
0 = Colors are defined as RGB (0xRRGGBB) (default)
1 = Colors are defined as BGR (0xBBGGRR) (the mode used in older versions of AutoIt)
ExpandEnvStrings Changes how literal strings and % symbols are interpreted. By default strings are treated literally, this option allows you to use %environment% variables inside strings, e.g., "The temp directory is: %temp%".
1 = expand environment variables (similar to AutoIt v2)
0 = do not expand environment variables (default)
Without this option the usual way would be: "The temp directory is: " & EnvGet("temp")
ExpandVarStrings Changes how literal strings and variable/macro ($ and @) symbols are interpreted. By default strings are treated literally, this option allows you to use variables and macros inside strings, e.g., "The value of var1 is $var1$".
1 = expand variables (when in this mode and you want to use a literal $ or @ then double it up: "This is a single dollar $$ sign".
0 = do not expand variables (default)
FtpBinaryMode Changes how FTP files are transferred.
1 = Binary (default)
0 = ASCII
GUICloseOnESC When ESC is pressed on a GUI the $GUI_EVENT_CLOSE message is sent. This option toggles this behavior on and off.
1 = Send the $GUI_EVENT_CLOSE message when ESC is pressed (default).
0 = Don't send the $GUI_EVENT_CLOSE message when ESC is pressed.
GUICoordMode Alters the position of a control defined by GUICtrlSetPos.
1 = absolute coordinates (default) still relative to the dialog box.
0 = relative position to the start of the last control (upper left corner)
2 = cell positionining relative to current cell. A -1 for left or top parameter don't increment the start. So next line is -1,0; next cell is 0,-1; current cell is -1,-1
GUIOnEventMode Enable/disable OnEvent functions notifications.
0 = (default) disable.
1 = enable.
GUIResizeMode Change default resizing for a control.
0 = (default) no resizing.
<1024 = anytype of resizing see GUICtrlSetResizing.
MouseClickDelay Alters the length of the brief pause in between mouse clicks.
Time in milliseconds to pause (default=10).
MouseClickDownDelay Alters the length a click is held down before release.
Time in milliseconds to pause (default=10).
MouseClickDragDelay Alters the length of the brief pause at the start and end of a mouse drag operation.
Time in milliseconds to pause (default=250).
MouseCoordMode Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:
0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window
MustDeclareVars If this option is used then all variables must be pre-declared with Dim, Local or Global before they can be used - removes the chance for misspelled variables causing bugs.
1 = Variables must be pre-declared
0 = Variables don't need to be pre-declared (default)
OnExitFunc Sets the name of the function called when AutoIt exits (default is OnAutoItExit).
PixelCoordMode Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the current active window:
0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window
RunErrorsFatal Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:
1 = fatal error (default)
0 = silent error (@error set to 1)
SendAttachMode Specifies if AutoIt attaches input threads when using then Send() function. When not attaching (default mode=0) detecting the state of capslock/scrolllock and numlock can be unreliable under NT4. However, when you specify attach mode=1 the Send("{... down/up}") syntax will not work and there may be problems with sending keys to "hung" windows. ControlSend() ALWAYS attaches and is not affected by this mode.
0 = don't attach (default)
1 = attach
SendCapslockMode Specifies if AutoIt should store the state of capslock before a Send function and restore it afterwards.
0 = don't store/restore
1 = store and restore (default)
SendKeyDelay Alters the the length of the brief pause in between sent keystrokes.
Time in milliseconds to pause (default=5). Sometimes a value of 0 does not work; use 1 instead.
SendKeyDownDelay Alters the length of time a key is held down before released during a keystroke. For applications that take a while to register keypresses (and many games) you may need to raise this value from the default.
Time in milliseconds to pause (default=1).
TrayIconDebug If enabled shows the current script line in the tray icon tip to help debugging.
0 = no debug information (default)
1 = show debug
TrayIconHide Hides the AutoIt tray icon. Note: The icon will still initially appear ~750 milliseconds.
0 = show icon (default)
1 = hide icon
WinDetectHiddenText Specifies if hidden window text can be "seen" by the window matching functions.
0 = Do not detect hidden text (default)
1 = Detect hidden text
WinSearchChildren Allows the window search routines to search child windows as well as top-level windows.
0 = Only search top-level windows (default)
1 = Search top-level and child windows
WinTextMatchMode Alters the method that is used to match window text during search operations.
1 = Complete / Slow mode (default)
2 = Quick mode
In quick mode AutoIt can usually only "see" dialog text, button text and the captions of some controls. In the default mode much more text can be seen (for instance the contents of the Notepad window).
If you are having performance problems when performing many window searches then changing to the "quick" mode may help.
WinTitleMatchMode Alters the method that is used to match window titles during search operations.
1 = Match the title from the start (default)
2 = Match any substring in the title
3 = Exact title match
4 = Advanced mode, see Window Titles & Text (Advanced)
WinWaitDelay Alters how long a script should briefly pause after a successful window-related operation.
Time in milliseconds to pause (default=250).

 

Related

Many!

 

Example


; copy any you want to change   ;default value is listed first

Opt("CaretCoordMode", 1)        ;1=absolute, 0=relative
Opt("ExpandEnvStrings", 0)      ;0=don't expand, 1=do expand
Opt("MouseClickDelay", 10)      ;10 milliseconds
Opt("MouseClickDownDelay", 10)  ;10 milliseconds
Opt("MouseClickDragDelay", 250) ;250 milliseconds
Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative
Opt("MustDeclareVars", 0)       ;0=no, 1=require pre-declare
Opt("PixelCoordMode", 1)        ;1=absolute, 0=relative
Opt("RunErrorsFatal", 1)        ;1=fatal, 0=silent set @error
Opt("SendAttachMode", 0)        ;0=don't attach, 1=do attach
Opt("SendCapslockMode", 1)      ;1=store and restore, 0=don't
Opt("SendKeyDelay", 5)          ;5 milliseconds
Opt("SendKeyDownDelay", 1)      ;1 millisecond
Opt("TrayIconDebug", 0)         ;0=no info, 1=debug line info
Opt("TrayIconHide", 0)          ;0=show, 1=hide tray icon
Opt("WinWaitDelay", 250)        ;250 milliseconds
Opt("WinDetectHiddenText", 0)   ;0=don't detect, 1=do detect
Opt("WinSearchChildren", 1)     ;0=no, 1=search children also
Opt("WinTitleMatchMode", 1)     ;1=start, 2=subStr, 3=exact, 4=...
Opt("WinWaitDelay", 250)        ;250 milliseconds