Hello,

I am quite new to MS-scripting; I wrote a script in .vbs catching
several OS characteristics for a local computer. Now I would make this
look pretty, and I am trying to send the output into a .hta : it works
nicely, but the script is rather slow, and the .hta won't output the
lines each time I write them, but all the lines at once : so unaware
people may stay and wonder what is happening.
Could I flush the output buffer in some way ? I browsed MSDN, but
without great success.
I tried outputting to the document itself using :

Set objDocument = self.Document
objDocument.open
(...)
objDocument.writeLn items ...

and also

the <SPAN> DataArea technique. Without success, all the lines are
output in one time.

(In the .hta, all the instructions are stored in the window_onload
sub.)

Does anybody have a hint ?

Regards
R. Grasso

Re: flushing stdout in a HTA ? by Bart

Bart
Tue Jan 24 16:44:48 CST 2006

Here's a copy of a method I put in an HTA, also, to grab some info about a
workstation.

I am populating a variable and then dumping it into the label all at once.
If I were to redo this I'd prbably blank the label out first thing so I can
see the values return. .

Hope this helps.

Bart

~~~~~~~~~~~~~~~~~~~
Sub GetOSVersion
On Error Resume Next

strComputer = GetStrComputer
If Trim(strComputer) <> "" Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
If ErrorConnecting(strComputer) = False Then
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
strHTML = strHTML & _
objOperatingSystem.Caption & " " & _
objOperatingSystem.Version & "<br>"
Next
DataArea1.InnerHTML = strHTML
End If
End If
End Sub ' End Sub GetOSVersion

~~~~~~~~~~~~~~~~~~~


<robert.grasso2@gmail.com> wrote in message
news:1138119961.584760.183290@g49g2000cwa.googlegroups.com...
> Hello,
>
> I am quite new to MS-scripting; I wrote a script in .vbs catching
> several OS characteristics for a local computer. Now I would make this
> look pretty, and I am trying to send the output into a .hta : it works
> nicely, but the script is rather slow, and the .hta won't output the
> lines each time I write them, but all the lines at once : so unaware
> people may stay and wonder what is happening.
> Could I flush the output buffer in some way ? I browsed MSDN, but
> without great success.
> I tried outputting to the document itself using :
>
> Set objDocument = self.Document
> objDocument.open
> (...)
> objDocument.writeLn items ...
>
> and also
>
> the <SPAN> DataArea technique. Without success, all the lines are
> output in one time.
>
> (In the .hta, all the instructions are stored in the window_onload
> sub.)
>
> Does anybody have a hint ?
>
> Regards
> R. Grasso
>



Re: flushing stdout in a HTA ? by robert

robert
Wed Jan 25 05:22:53 CST 2006

Hello Bart,

Thank you for your answer. Unfortunately I built a script much longer
than yours, with a much longer output listing : I am querying the OS,
the local disks, the page files, some system drivers and more. All this
(querying the OS, the disks) takes many seconds, and all the lines are
output at once. Thus what I am looking for (whenever it exists) is
really a flush command. It seems that it exist if the script is run on
a server (the method Response.Flush looks like what I am meaning) , but
browsing around I don't see any flush method for an HTA.


Re: flushing stdout in a HTA ? by deckhopper

deckhopper
Wed Jan 25 06:54:31 CST 2006

Try the following:

<html>
<head>
<title>OS Details</title>

<HTA:APPLICATION
ID="objOSDetails"
APPLICATIONNAME="OSDetails"
SCROLL="yes"
SINGLEINSTANCE="no"
WINDOWSTATE="normal">
</head>

<script language="VBScript">
Set objShell = CreateObject("WScript.Shell")
Dim iTimerID
Dim StartTime

Function Window_OnLoad()
Const iWIDTH = 525
Const iHEIGHT = 450
Window.ResizeTo iWIDTH, iHEIGHT
Window.MoveTo (Screen.availWidth-iWIDTH)/2,_
(Screen.availHeight-iHEIGHT)/2
End Function

Sub GetOSVersion
StartTime = Timer ' Start the timer
strComputer = "."

' Display msgbox with elapsed time while machine is working
' Msgbox will popup every 1.5 seconds
' User still has to hit OK
' ~~~~~~~~~~~~~~~~
iTimerID = window.setInterval("showMsg", 1500)
' ~~~~~~~~~~~~~~~~

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
strHTML = strHTML & _
objOperatingSystem.Caption & " " & _
objOperatingSystem.Version & "<br>" &_
objOperatingSystem.BootDevice & "<br>" &_
objOperatingSystem.BuildNumber & "<br>" &_
objOperatingSystem.BuildType & "<br>" &_
objOperatingSystem.CodeSet & "<br>" &_
objOperatingSystem.CountryCode & "<br>" &_
objOperatingSystem.CurrentTimeZone & "<br>" &_
objOperatingSystem.EncryptionLevel & "<br>" &_
objOperatingSystem.InstallDate & "<br>" &_
objOperatingSystem.Name & "<br>" &_
objOperatingSystem.LastBootUpTime & "<br>" &_
objOperatingSystem.LocalDateTime & "<br>" &_
objOperatingSystem.NumberOfLicensedUsers & "<br>" &_
objOperatingSystem.SerialNumber & "<br>"
Next

' Stop the timer and stop displaying msgbox
' ~~~~~~~~~~~~~~~~
StopTimer
' ~~~~~~~~~~~~~~~~

DataArea1.InnerHTML = strHTML
refresh01.focus()
End Sub

Sub showMsg
' You could tinker with this to show an external IE window
' that would display the elapsed time (instead of msgbox)
Msgbox "Waiting...",0,"Elapsed Time: " _
& FormatNumber(Timer-StartTime,0)
End Sub

Sub RunScriptHTARefresh
StopTimer
Location.Reload(True)
End Sub

Sub StopTimer
window.clearInterval(iTimerID)
End Sub
</script>

<body>
<input id=start class="submit" type="submit"
value="Start" name="start" onClick="GetOSVersion"><br>
<input id=refresh01 class="button" type="button"
value="Refresh" name="refresh"
onClick="RunScriptHTARefresh"><br>

<center><span id="DataArea1" name="DataArea">
</span></center>
</body>
</html>