Jump to content

HTA in PE won't refresh span data without mouse activity(!)


Recommended Posts

Posted

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 30
End Sub

Sub 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
Next
End Sub

Sub 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>


Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...