You cannot do this with the default VBScript dialog elements like MsgBox , WScript.Echo or Popup . You need to create a custom dialog using the Internet Explorer COM object:
Set ie = CreateObject("InternetExplorer.Application") ie.Navigate "about:blank" While ie.ReadyState <> 4 : WScript.Sleep 100 : Wend ie.ToolBar = False ie.StatusBar = False ie.Width = 300 ie.Height = 200 ie.document.body.innerHTML = "<p id='msg'>0</p>" Set style = ie.document.CreateStyleSheet style.AddRule "p", "text-align: center;" ie.Visible = True i = 1 Do ie.document.getElementById("msg").innerText = i i = i + 1 WScript.Sleep 2000 Loop Until i > 10
or use HTA instead of regular VBScript:
<head> <title>Test</title> <HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Test" SCROLL="no" > </head> <style type="text/css"> p {text-align: center;} </style> <script language="VBScript"> window.resizeTo 300, 200 Set sh = CreateObject("WScript.Shell") Sub Window_onLoad For i = 1 To 10 msg.innerText = i Sleep 2 Next End Sub Sub Sleep(t) sh.Run "ping -n " & (t+1) & " 127.0.0.1", 0, True End Sub </script> <body> <p id="msg">0</p> </body>
Ansgar wiechers
source share