WreX Posted November 27, 2007 Share Posted November 27, 2007 I'm writing an HTA whose body is broken down into tables with one of the top rows used for displaying status messages via a span. I'd like to include a 30 second countdown in the status before something automatically happens. Since HTA VBScript is too awesome to include a Sleep, I pause for 1 second by calling a subroutine that pings 127.0.0.1. This works fine when I run it on XP, but when I run it in PE, the message doesn't automatically refresh unless there's mouse / touchpad activity, even if I replace the pings with a simple msgbox. Has anyone else seen this? Is there any solution to it? Below is some sample code.<html><head><title>Test</title><HTA:APPLICATION ID="objTEST" APPLICATIONNAME="TEST" SCROLL="yes" SINGLEINSTANCE="yes"></head><script Language="VBScript">Sub Window_OnLoad ShowCountdown 30End SubSub ShowCountdown(howlong) For i = howlong To 0 Step -1 If i <> 0 Then status_msg.InnerHTML = "Device Imaging will begin in " & i & " seconds..." Else status_msg.InnerHTML = "Rebooting device to begin imaging..." End If DoSleep 1 NextEnd SubSub DoSleep(seconds) set oShell = CreateObject("Wscript.Shell") cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul" oShell.Run cmd,0,1'msgbox "pause" End Sub</SCRIPT><body><table width="100%" border> <tr> <td ALIGN=CENTER HEIGHT=40 style="font-size:12pt;"><span id="status_msg"></span></td> </tr></table></body></html> Link to comment Share on other sites More sharing options...
Pyrosoft Posted November 28, 2007 Share Posted November 28, 2007 wscript.sleep(30000)This might work for you. Link to comment Share on other sites More sharing options...
WreX Posted December 3, 2007 Author Share Posted December 3, 2007 wscript.sleep() doesn't work in HTA, that's the problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now