我在 AutoIT 中创建了一个简单的脚本,用于检查字符串是否存在,如果存在,它将显示标签,否则它将显示另一个标签,这是脚本:
$text = $oHTTP.ResponseText
$status = $oHTTP.Status
If $status = 200 Then
$array = _StringBetween($text, '<span class="d1">', "</span>")
If $array[0] == "" Then
GUICtrlSetState($v2l1, $GUI_SHOW)
ELSE
GUICtrlSetState($v2l2, $GUI_SHOW)
EndIf
Else
ConsoleWrite(@error)
EndIf
如果它找到任何东西,那么标签会出现,但如果它没有找到字符串,它会给我一个错误并退出:
Subscript used on non-accessible variable.:
If $array[0] == "" Then
If $array^ ERROR
那么无论如何我可以解决这个问题吗?我的意思是如果 $array 没有找到它使 $v2l2 可见的字符串。
先谢谢了。