我正在使用超时= 2秒的msgbox,我希望在msgbox超时后继续运行脚本。
例如我的代码是这样的:
$log = 'C:\notepad.log'
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is first line{ENTER}okay{ENTER}")
sleep (200)
msgbox (1,"debug","debug",2)
Send("This is second line{ENTER}okay{ENTER}")
sleep (200)
Send("This is third line{ENTER}okay{ENTER}")
sleep (200)
Send("!f")
send ("{DOWN}{DOWN}{ENTER}")
sleep (500)
Send($log)
sleep (1000)
Send("{ENTER}")
sleep (200)
WinClose("[CLASS:Notepad]")
* ##############
在这里,我使用"msgbox (1,"debug","debug",2)"
,在2秒后超时&在此之后它不会发送命令
Send("This is second line{ENTER}okay{ENTER}")
sleep (200)
Send("This is third line{ENTER}okay{ENTER}")
请建议如何处理此超时。
请注意我的申请需要定义TIMEOUT&然后继续编写脚本。
答案 0 :(得分:0)
问题是,在显示msgbox后,记事本可能不再是活动窗口。
在msgbox行之后放置WinActivate命令以重新激活记事本窗口
WinActivate("Untitled - Notepad")
答案 1 :(得分:0)
Yeh Richard是对的,你必须重新激活窗口,你应该
$log = 'C:\notepad.log'
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is first line{ENTER}okay{ENTER}")
sleep (200)
msgbox (1,"debug","debug",2)
WinActivate("Untitled - Notepad")
Send("This is second line{ENTER}okay{ENTER}")
sleep (200)
Send("This is third line{ENTER}okay{ENTER}")
sleep (200)
Send("!f")
send ("{DOWN}{DOWN}{ENTER}")
sleep (500)
Send($log)
sleep (1000)
Send("{ENTER}")
sleep (200)
WinClose("[CLASS:Notepad]")