IsArray
检查变量是否为数组类型.
IsArray ( variable )
参数
返回值
成功:
|
返回 1
|
失败:
|
返回 0, 变量不是数组
|
备注
可有效验证传递到用户定义函数的参数是否为数组.
详细说明参考 语言参考-数据类型.
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
; Retrieve the position and size of the Notepad window by passing the handle to WinGetPos.
Local $aPos = WinGetPos($hWnd)
; Check if the variable is an array.
If IsArray($aPos) Then
MsgBox($MB_SYSTEMMODAL, "", "Window height: " & $aPos[3])
Else
MsgBox($MB_SYSTEMMODAL, "", "An error occurred.")
EndIf
; Close the Notepad window using the handle returned by WinWait.
WinClose($hWnd)
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令 exect 调用
参见:
VarGetType, UBound, _ReDim
exect=$var_aa=StringSplit('aa|bb|aa|cc|dd|aa|bb|ee|aa','|',2)||$var_i=IsArray(Eval('var_aa'))||_ViewValues($var_i)||$var_aa='Hello'||$var_i=IsArray(Eval('var_aa'))||_ViewValues($var_i) ;; 检查的一个例子是变量数组欧姆或无
exect=$var_a=PixelSearch(0,0,20,300,0xFF0000)||IsArray($var_a)?_ViewValues($var_a):_ViewValues('颜色~~не~~найден') ;; 获得红色颜色a的数组像素坐标
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|