AutoItSetOption

From AutoIt Wiki
Revision as of 03:37, 16 August 2013 by Jaberwocky6669 (talk | contribs)
Jump to navigation Jump to search

Description

Changes the operation of various AutoIt functions/parameters.

Syntax

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.

ReturnValue

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).
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 AutoItSetOption Options are as follows:

Options Param
CaretCoordMode CaretCoordMode ets the way coords are used in the caret functions, either absolute coords or coords relative to the current active window:
ExpandEnvStrings ExpandEnvStrings hanges 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%".
ExpandVarStrings ExpandVarStrings hanges 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$".
GUICloseOnESC GUICloseOnESC hen ESC is pressed on a GUI the $GUI_EVENT_CLOSE message is sent. This option toggles this behavior on and off.
GUICoordMode <a name="GUICoordMode"></a>Alters the position of a control defined by GUICtrlSetPos
GUIDataSeparatorChar <a name="GUIDataSeparatorChar"></a>Define the character which delimits subitems in GUICtrlSetData
GUIOnEventMode GUIOnEventMode nable/disable OnEvent functions notifications.
GUIResizeMode GUIResizeMode hange default resizing for a control.
GUIEventOptions GUIEventOptions hange special event behavior or GUI function return values.
MouseClickDelay MouseClickDelay lters the length of the brief pause in between mouse clicks.
MouseClickDownDelay MouseClickDownDelay lters the length a click is held down before release.
MouseClickDragDelay MouseClickDragDelay lters the length of the brief pause at the start and end of a mouse drag operation.
MouseCoordMode MouseCoordMode ets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:
MustDeclareVars MustDeclareVars f this option is used then all variables must be pre-declared with Local, Global or in some cases Dim before they can be used - removes the chance for misspelled variables causing bugs.
PixelCoordMode PixelCoordMode ets the way coords are used in the pixel functions, either absolute coords or coords relative to the window defined by hwnd (default active window):
SendAttachMode <a name="SendAttachMode"></a>Specifies if AutoIt attaches input threads when using 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.
SendCapslockMode <a name="SendCapslockMode"></a>Specifies if AutoIt should store the state of capslock before a Send function and restore it afterwards.
SendKeyDelay SendKeyDelay lters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely.
SendKeyDownDelay SendKeyDownDelay lters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses you may need to raise this value from the default. A value of 0 removes the delay completely.
TCPTimeout TCPTimeout efines the time before TCP functions stop if no communication.
TrayAutoPause TrayAutoPause cript pauses when click on tray icon.
TrayIconDebug TrayIconDebug f enabled shows the current script line in the tray icon tip to help debugging.
TrayIconHide TrayIconHide ides the AutoIt tray icon. Note: The icon will still initially appear ~750 milliseconds.
TrayMenuMode TrayMenuMode xtend the behaviour of the script tray icon/menu. This can be done with a combination (adding) of the following values.
TrayOnEventMode TrayOnEventMode nable/disable OnEvent functions notifications for the tray.
WinDetectHiddenText WinDetectHiddenText pecifies if hidden window text can be "seen" by the window matching functions.
WinSearchChildren WinSearchChildren llows the window search routines to search child windows as well as top-level windows.
WinTextMatchMode WinTextMatchMode lters the method that is used to match window text during search operations.
WinTitleMatchMode WinTitleMatchMode lters the method that is used to match window titles during search operations.
WinWaitDelay WinWaitDelay lters how long a script should briefly pause after a successful window-related operation.

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