AutoItSetOption

From AutoIt Wiki
Revision as of 06:42, 18 August 2013 by Jaberwocky6669 (talk | contribs)
Jump to navigation Jump to search

Description

Changes the operation of various AutoIt functions/parameters.

AutoItSetOption ( "option" [, param] )

Parameters

option The option to change. See Remarks.
param [optional] The value to assign to the option. The type and meaning vary by option. See remarks below. If the param is not provided, then the function just returns the value already assigned to the option. The keyword Default can be used for the parameter to reset the option to its default value.

Return Value

Success: Returns the value of the previous setting for the option.
Failure: Sets @error to non-zero. Failure will occur if the parameters are invalid (such as an option that doesn't exist).

Remarks

You may use Opt as an alternative to Opt

Options are as follows:

Option Param
CaretCoordMode 0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window
ExpandEnvStrings 0 = do not expand environment variables (default)
1 = expand environment variables
Without this option the usual way would be: "The temp directory is: " & EnvGet("temp")
ExpandVarStrings 0 = do not expand variables (default)
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".
GUICloseOnESC 0 = Don't send the $GUI_EVENT_CLOSE message when ESC is pressed.
1 = Send the $GUI_EVENT_CLOSE message when ESC is pressed (default).
GUICoordMode 0 = relative position to the start of the last control (upper left corner).
1 = absolute coordinates (default) still relative to the dialog box.
2 = cell positioning relative to current cell. A -1 for left or top parameter don't increment the start.
So next line is -1, offset; next cell is offset,-1; current cell is -1,-1.
Obviously "offset" cannot be -1 which reserved to indicate the no increment. But if you can use a multiple of the width you choose to skip or go back.
GUIDataSeparatorChar '.
GUIOnEventMode 0 = (default) disable.
1 = enable.
GUIResizeMode 0 = (default) keep default control resizing.
<1024 = any type of resizing see GUICtrlSetResizing
GUIEventOptions 0 = (default) Windows behavior on click on Minimize,Restore, Maximize, Resize.
1 = suppress windows behavior on minimize, restore or maximize click button or window resize. Just sends the notification.
MouseClickDelay Time in milliseconds to pause (default=10).
MouseClickDownDelay Time in milliseconds to pause (default=10).
MouseClickDragDelay Time in milliseconds to pause (default=250).
MouseCoordMode 0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window
MustDeclareVars 0 = Variables don't need to be pre-declared (default)
1 = Variables must be pre-declared
PixelCoordMode 0 = relative coords to the defined window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the defined window
SendAttachMode 0 = don't attach (default)
1 = attach
SendCapslockMode 0 = don't store/restore
1 = store and restore (default)
SendKeyDelay Time in milliseconds to pause (default=5).
SendKeyDownDelay Time in milliseconds to pause (default=5).
TCPTimeout Time in milliseconds before timeout (default=100).
TrayAutoPause 0 = no pause
1 = pause (default). If there is no DefaultMenu no pause will occurs.
TrayIconDebug 0 = no debug information (default)
1 = show debug
TrayIconHide 0 = show icon (default)
1 = hide icon
TrayMenuMode 0 = default menu items (Script Paused/Exit) are appended to the usercreated menu; usercreated checked items will automatically unchecked; if you double click the tray icon then the controlid is returned which has the "Default"-style (default).
1 = no default menu
2 = user created checked items will not automatically unchecked if you click it
4 = don't return the menuitemID which has the "default"-style in the main contextmenu if you double click the tray icon
8 = turn off auto check of radio item groups
TrayOnEventMode 0 = (default) disable
1 = enable
WinDetectHiddenText 0 = Do not detect hidden text (default)
1 = Detect hidden text
WinSearchChildren 0 = Only search top-level windows (default)
1 = Search top-level and child windows
WinTextMatchMode 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 1 = Match the title from the start (default)
2 = Match any substring in the title
3 = Exact title match
4 = Advanced mode, see <a href="../intro/windowsadvanced.htm">Window Titles & Text (Advanced)</a>
-1 to -4 = force lower case match according to other type of match (case-insensitive match.)
WinWaitDelay Time in milliseconds to pause (default=250).

Example

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

Opt("CaretCoordMode", 1) ;1=absolute, 0=relative, 2=client
Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand
Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand
Opt("GUICloseOnESC", 1) ;1=ESC  closes, 0=ESC won't close
Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell
Opt("GUIDataSeparatorChar", "|") ;"|" is the default
Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled
Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing
Opt("GUIEventOptions", 0) ;0=default, 1=just notification, 2=GUICtrlRead tab index
Opt("MouseClickDelay", 10) ;10 milliseconds
Opt("MouseClickDownDelay", 10) ;10 milliseconds
Opt("MouseClickDragDelay", 250) ;250 milliseconds
Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client
Opt("MustDeclareVars", 0) ;0=no, 1=require pre-declaration
Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client
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("TCPTimeout", 100) ;100 milliseconds
Opt("TrayAutoPause", 1) ;0=no pause, 1=Pause
Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info
Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon
Opt("TrayMenuMode", 0) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID  not return
Opt("TrayOnEventMode", 0) ;0=disable, 1=enable
Opt("WinDetectHiddenText", 0) ;0=don't detect, 1=do detect
Opt("WinSearchChildren", 1) ;0=no, 1=search children also
Opt("WinTextMatchMode", 1) ;1=complete, 2=quick
Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinWaitDelay", 250) ;250 milliseconds