我想通过vbscript清除或自动关闭弹出窗口,但它们可能是不同的弹出窗口,也可能是弹出窗口中的弹出窗口。 我正在使用vbscript创建弹出窗口,我想要一个自动关闭所有弹出窗口的脚本。下面是创建弹出窗口的脚本,我想通过脚本关闭所有这些弹出窗口。
Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Do you like your job?", 7, "Answer This Question:", 4 + 32)
Select Case BtnCode
case 6 WScript.Echo "That's great!."
case 7 WScript.Echo "Sorry to hear that."
case -1 WScript.Echo "No Response?"
End Select
我对上面代码部分工作的解决方案:
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("Answer this question")
If ret = True Then
wshShell.SendKeys "%Y"
Exit Do
End If
WScript.Sleep 500
Loop