Mem*_*hiZ 5 windows autoit wait
我想知道它是否可能同时为"WindowWithThisTitle"和"WindowWithThatTitle"提供"WinWaitActive".我正在执行一个命令,可能会有一个窗口告诉我连接失败或用户/通过对话框出现.
还有另外一种方式吗?
WinWaitActive("Title1", "", 5)
If(WinExists("Title1")) Then
MsgBox(0, "", "Do something")
Else
If(WinExists("Title2")) Then
MsgBox(0, "", "Do something else")
EndIf
EndIf
Run Code Online (Sandbox Code Playgroud)
因为我不希望超时超过15秒.
提前致谢!
这样的事情怎么样。
$stillLooking = True
While $stillLooking
$activeWindowTitle = WinGetTitle(WinActive(""))
If $activeWindowTitle == "Title1" Then
MsgBox(0, "", "Do something")
$stillLooking = False
ElseIf $activeWindowTitle == "Title2" Then
MsgBox(0, "", "Do something else")
$stillLooking = False
EndIf
sleep(5)
WEnd
Run Code Online (Sandbox Code Playgroud)
因为我不想超时可能超过15秒。
除非您指定WinWaitActive(),否则它没有超时。您给它设置了五秒钟的超时时间,但是您可以将其保留,这样它将永远等待。
一个更简单的解决方案可能是在您WinWaitActive定义的位置使用REGEX标题:http : //www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm
然后,您将得到以下内容:
$hWnd = WinWaitActive("[REGEXPTITLE:(WindowWithThisTitle|WindowWithThatTitle)]")
If WinGetTitle($hWnd) = "WindowWithThisTitle" then
DoSomething()
Else
DoSomethingElse()
EndIf
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14312 次 |
| 最近记录: |