【发布时间】:2012-07-27 20:51:41
【问题描述】:
有没有办法让msgbox在一秒钟内显示并消失,我一直在使用下面的脚本,但只能让它在一秒钟内关闭。
选项显式 Dim Wshell, BtnCode 设置 Wshell = CreateObject("wscript.shell")
BtnCode= Wshell.Popup("test", 1, "testing")
【问题讨论】:
标签: vbscript
有没有办法让msgbox在一秒钟内显示并消失,我一直在使用下面的脚本,但只能让它在一秒钟内关闭。
选项显式 Dim Wshell, BtnCode 设置 Wshell = CreateObject("wscript.shell")
BtnCode= Wshell.Popup("test", 1, "testing")
【问题讨论】:
标签: vbscript
恐怕这在弹出窗口中是不可能的。 不过,您可以使用 Internet Explorer 作为 UI 来做到这一点。
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate("about:blank")
.Document.Title = "Countdown" & string(100, chrb(160))
.resizable=0
.height=200
.width=100
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
End With
' wait for page to load
Do while oIE.Busy
wscript.sleep 50
Loop
' prepare document body
oIE.document.body.innerHTML = "<div id=""countdown"" style=""font: 36pt sans-serif;text-align:center;""></div>"
oIE.document.all.countdown.innerText= "test message"
'the parameters is in miliseconds, so here the message is shown for half a second
wscript.sleep 500
oIE.quit
【讨论】: