Example If Not IsDeclared "a" then MsgBox0,"", "$a is NOT declared" ; $a has never been assigned EndIf $a=1 If IsDeclared "a" then MsgBox0,"", "$a IS declared" ; due to previous $a=1
Trang 1Example
If Not IsDeclared ("a") then
MsgBox(0,"", "$a is NOT declared") ; $a has never been assigned
EndIf
$a=1
If IsDeclared ("a") then
MsgBox(0,"", "$a IS declared" ) ; due to previous $a=1 assignment
EndIf
Function Reference
IsDllStruct
Checks if a variable is a DllStruct type
IsDllStruct ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if expression is not DllStruct type as return by DllStructCreate
Remarks
Trang 2None
Related
DllStructCreate
Example
$struct = DllStructCreate("char[256]")
$x = IsDllStruct($struct)
Function Reference
IsFloat
Checks if a variable or expression is a float-type IsFloat ( variable )
Parameters
variable The variable or expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if expression is not float type
Remarks
See examples
Trang 3Related
IsArray, IsInt, IsString, IsNumber, IsBool, IsHWnd, StringIsFloat
Example
IsFloat(3.14159) ;returns 1
IsFloat(3.000) ;returns 0 since value is integer 3
IsFloat(1/2 - 5) ;returns 1
IsFloat(1.5e3) ;returns 0 since 1.5e3 = 1500
IsFloat("12.345") ;returns 0 since is a string
Function Reference
IsHWnd
Checks if a variable's base type is a pointer and window handle
IsHWnd ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1 if the expression is a pointer type AND a valid window handle Failure: Returns 0 if expression is not a pointer OR not a valid window handle
Remarks
Trang 4Related
IsArray, IsFloat, IsInt, IsPtr, IsString, IsNumber, IsBool
Example
Run("notepad.exe")
Local $hWnd = WinGetHandle("[CLASS:Notepad]")
If IsHWnd($hWnd) Then
MsgBox(4096, "", "It's a valid HWND")
Else
MsgBox(4096, "", "It's not an HWND")
EndIf
Function Reference
IsHWnd
Checks if a variable's base type is a pointer and window handle
IsHWnd ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1 if the expression is a pointer type AND a valid window handle Failure: Returns 0 if expression is not a pointer OR not a valid window handle
Trang 5Remarks
Related
IsArray, IsFloat, IsInt, IsPtr, IsString, IsNumber, IsBool
Example
Run("notepad.exe")
Local $hWnd = WinGetHandle("[CLASS:Notepad]")
If IsHWnd($hWnd) Then
MsgBox(4096, "", "It's a valid HWND")
Else
MsgBox(4096, "", "It's not an HWND")
EndIf
Function Reference
IsInt
Checks if a variable or expression is an integer type IsInt ( variable )
Parameters
variable The variable/expression to check
Return Value
Success: Returns 1
Failure: Returns 0 if expression is not integer
Trang 6
Remarks
IsInt(7.5 - 2.5) returns 1 (meaning true)
Related
IsArray, IsFloat, IsString, IsNumber, IsBool, IsHWnd, StringIsInt
Example
IsInt(-12345) ;returns 1
IsInt(3.0000) ;returns 1
IsInt("5432") ;returns 0 since is a string
IsInt(7.5 - 4.5) ;returns 1 since evaluates to integer 3
Function Reference
IsKeyword
Checks if a variable is a keyword (for example, Default)
IsKeyword ( variable )
Parameters
variable The variable to check
Return Value
Success: Returns 1 if variable is a keyword
Failure: Returns 0 if variable is not a keyword
Trang 7
Remarks
Related
Default
Example
$a = default
If IsKeyword($a) Then MsgBox(0,"Ok", "Yes it is")
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
Trang 8Related
IsArray, IsFloat, IsInt, IsNumber, IsString, IsHWnd
Example
$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
Trang 9If 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
Example
If Not IsDeclared ("a") then
MsgBox(0,"", "$a is NOT declared") ; $a has never been assigned
EndIf
$a=1
If IsDeclared ("a") then
MsgBox(0,"", "$a IS declared" ) ; due to previous $a=1 assignment
EndIf
Function Reference
IsDllStruct
Checks if a variable is a DllStruct type
IsDllStruct ( variable )
Parameters
variable The variable/expression to check
Return Value
Trang 10Success: Returns 1
Failure: Returns 0 if expression is not DllStruct type as return by DllStructCreate
Remarks
None
Related
DllStructCreate
Example
$struct = DllStructCreate("char[256]")
$x = IsDllStruct($struct)
Function Reference
IsFloat
Checks if a variable or expression is a float-type
IsFloat ( variable )
Parameters
variable The variable or expression to check
Return Value
Success: Returns 1
Trang 11Failure: Returns 0 if expression is not float type
Remarks
See examples
Related
IsArray, IsInt, IsString, IsNumber, IsBool, IsHWnd, StringIsFloat
Example
IsFloat(3.14159) ;returns 1
IsFloat(3.000) ;returns 0 since value is integer 3
IsFloat(1/2 - 5) ;returns 1
IsFloat(1.5e3) ;returns 0 since 1.5e3 = 1500
IsFloat("12.345") ;returns 0 since is a string
Function Reference
IsHWnd
Checks if a variable's base type is a pointer and window handle IsHWnd ( variable )
Parameters
variable The variable/expression to check
Return Value
Trang 12Success: Returns 1 if the expression is a pointer type AND a valid window handle Failure: Returns 0 if expression is not a pointer OR not a valid window handle
Remarks
Related
IsArray, IsFloat, IsInt, IsPtr, IsString, IsNumber, IsBool
Example
Run("notepad.exe")
Local $hWnd = WinGetHandle("[CLASS:Notepad]")
If IsHWnd($hWnd) Then
MsgBox(4096, "", "It's a valid HWND")
Else
MsgBox(4096, "", "It's not an HWND")
EndIf
Function Reference
IsInt
Checks if a variable or expression is an integer type
IsInt ( variable )
Parameters
variable The variable/expression to check