SetError code [, extended [, return value]] Parameters code The required value integer to set the @error macro to.. return value Override the default return value and return this para
Trang 1WinTitleMatchMode
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) -1 to -4 = force lower case match according to other type of match
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, 2=client
Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand
Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand
Opt("FtpBinaryMode", 1) ;1=binary, 0=ASCII
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-declare
Opt("OnExitFunc","OnAutoItExit");"OnAutoItExit" called
Trang 2Opt("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
Function Reference
SetError
Manually set the value of the @error macro
SetError ( code [, extended [, return value]] )
Parameters
code The required value (integer) to set the @error macro to
extended The optional value (integer) to set the @extended macro to This sets
the same macro as the SetExtended() function
return
value Override the default return value and return this parameter
Trang 3
Return Value
By default, none, however if the optional return value argument is passed, then the function will return that value
Remarks
When entering a function @error is set to 0 Unless SetError() is called, then
@error will remain 0 after the function has ended This means that in order for
@error to be set after a function, it must be explicitly set This also means you may need to backup the status of @error in a variable if you are testing it in a While-WEnd loop
The extended parameter is optional It is only provided as a way to set both @error and @extended at the same time If only @extended needs set, then it is
recommended to use the SetExtended() function instead
Related
SetExtended
Example
$result = myDiv(5, 0)
If @error Then
MsgBox(4096,"Error", "Division by Zero")
Else
MsgBox(4096, "Result", $result)
EndIf
Exit
Func myDiv($dividend, $divisor)
If $dividend = 0 And $divisor = 0 Then
SetError(2) ;indeterminate form 0/0
ElseIf $divisor = 0 Then
SetError(1) ;plain division by zero
EndIf
Return $dividend / $divisor
EndFunc
Trang 4Function Reference
SetExtended
Manually set the value of the @extended macro
SetExtended ( code [, return value] )
Parameters
code The required value (integer) to set the @extended macro to
return
value Override the default return value and return this parameter
Return Value
By default, none, however, if the optional return value argument is passed, then the function will return that value
Remarks
When entering a function @extended is set to 0 Unless SetExtended() is called, then @extended will remain 0 after the function has ended This means that in order for @extended to be set after a function, it must be explicitly set This also means you may need to backup the status of @extended in a variable if you are testing it in a While-WEnd loop
Related
SetError
Example
Trang 5SetExtended(10)
MsgBox(4096, "Value of @Extended is", @extended)
Function Reference
IsArray
Checks if a variable is an array type
IsArray ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if parameter is not an array variable
Remarks
Can be useful to validate array/non-array parameters to user-defined functions
Related
IsFloat, IsInt, IsString, IsNumber, IsBool, IsHWnd
Example
Trang 6$pos = WinGetPos("Untitled -")
If IsArray($pos) Then
MsgBox(0, "Window height", $pos[3])
EndIf
Function Reference
IsBinary
Checks if a variable or expression is a binary type
IsBinary ( expression )
Parameters
variable The variable or expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if expression is not binary type
Remarks
None
Related
IsArray, IsFloat, IsInt, IsString, IsNumber, IsBool, IsHWnd
Example
Trang 7$bin = Binary("0x00204060")
$str = "0x00204060"
msgbox(0, "IsBinary $bin", IsBinary($bin))
msgbox(0, "IsBinary $str", IsBinary($str))
Function Reference
IsBool
Checks if a variable's base type is boolean
IsBool ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if expression is not boolean type
Remarks
Related
IsArray, IsFloat, IsInt, IsNumber, IsString, IsHWnd
Example
Trang 8$b = true
If IsBool($b) Then Msgbox(0,"Success", "$b is a boolean variable")
Function Reference
IsDeclared
Check if a variable has been declared
IsDeclared ( expression )
Parameters
expression string representing name of the variable to be checked
Return Value
Success: Returns 1 for Global variable or variable declared outside functions Special: -1 for Local variable
Failure: Return 0 when no variable can be found
Remarks
If there is a need to use IsDeclared() to check that a variable exists, then in most situations Assign() should be used to create/write to the variable and Eval() should
be used to read from the variable
Related
Assign, Eval