VBScript 检测打开的消息框并关闭它 [英] VBScript to detect an open messagebox and close it
本文介绍了VBScript 检测打开的消息框并关闭它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种使用 VBScript 检测和关闭打开的系统消息框的方法.
I'm looking for a way to detect and close an open system messagebox with VBScript.
使用以下脚本,我可以将消息置于前台并关闭它:
Using the following script, I can bring the message to foreground and close it:
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActive "System Settings Change"
WshShell.SendKeys "%N"
问题:我需要一种方法来检测消息框是否正在使用 VBsciprt 等待用户交互,以便我可以关闭它.
The Question: I need a way to detect if a messagebox is waiting user interaction using VBsciprt so I can close it.
谢谢你.
推荐答案
下面的脚本将完全按照我的要求执行.
The script below will do exactly what I asked.
' Will loop forever checking for the message every half a second
' until it finds the message then it will send Alt-N and quit.
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("System Settings Change")
If ret = True Then
wshShell.SendKeys "%N"
Exit Do
End If
WScript.Sleep 500
Loop
这篇关于VBScript 检测打开的消息框并关闭它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文