VBScript 使用 Vbscript 图形元素显示倒计时
我想显示一个 MessageBox,它显示从 10 到 1 的倒计时,并在 10 秒后自动关闭。由于 vbscript 中的 Msgbox 传递代码执行直到用户对其进行操作,我尝试使用 Wscript Shell 对象中的 Popup 进行操作,
Dim counter Dim oShell counter = 10 Set oShell= CreateObject("Wscript.Shell") While counter > 0 oShell.Popup " Left " & counter & " Seconds",1,"Remind" counter = counter-1 Wend
但它每秒自动关闭并打开一个新的弹出窗口,有什么方法可以使用可用的 GUI 显示倒计时和自动关闭vb脚本中的元素
I wanted to display a MessageBox which displays countdown from 10 to 1 and autocloses after 10 seconds. As Msgbox in vbscript passes code execution untill the user acts on it i tried it using Popup in Wscript Shell Object
Dim counter Dim oShell counter = 10 Set oShell= CreateObject("Wscript.Shell") While counter > 0 oShell.Popup " Left " & counter & " Seconds",1,"Remind" counter = counter-1 Wend
But it auto-closes for every second and opens a new popup is there any way i can display the countdown and autoclose using the available GUI elements in vb script
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用 Internet Explorer 创建非模式显示。
You can use Internet Explorer to create a non-modal display.
不用担心,弹出窗口是模态的,并且是模态的。显示时无法与之交互,因此无法更新其现有内容。
如果您想要更灵活的 UI,您将需要使用不同的东西,即 HTA 中的控制台或 HTML。
Afraid not, the popup is modal & can't be interacted with while its displayed so there is no way to update its existing content.
If you want a more flexible UI you will need to use something different, the console or HTML in an HTA.
我有一个代码,但它可能没有帮助
,请原谅我奇怪的变量名称。
此代码来自 https://wellsr.com/vba /2015/vbscript/vbscript-timer-with-wscript-sleep/
I have a code, but it might not help
please excuse my weird variable names.
This code is from https://wellsr.com/vba/2015/vbscript/vbscript-timer-with-wscript-sleep/
实际上可以编辑倒计时,对于 VBScript 来说非常容易,所以我不明白问题是什么。
这是代码:
It actually is possible to edit the countdown, very easily for VBScript, so I don't understand what the problem is.
Here's the code: