Re: HTA - Refresh
- From: Tom Lavedas <tglbatch@xxxxxxx>
- Date: Wed, 30 Apr 2008 10:50:24 -0700 (PDT)
On Apr 30, 12:14 pm, "JHP" <goaways...@xxxxxxx> wrote:
I thought about that, but I wont be able to use it with this situation as
I'm parsing over 100,000 lines (a second per line adds over 27 hours).
Thank you for replying.
"Tom Lavedas" <tglba...@xxxxxxx> wrote in message
news:23fcad21-b73c-483d-bf39-679a34be94ab@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 30, 9:33 am, "JHP" <goaways...@xxxxxxx> wrote:
No sure if this is the right forum. but I hope someone can help - I've
been
searching for an answer for days - and I bet it's something simple I have
over looked.
That said:
I have written a simple HTA script that iterates through parsing a text
file
by line, incrementing a Progress Bar. But because of the long process
the
background disappears if anything overlaps it, and a text <div> is not
updated.
How do I refresh (repaint) the HTA.
NB: The ProgressBar is "of Object" - and not affected:
<object classid="clsid:35053A22-8589-11D1-B16A-00C0F0283628"
id="ProgressBar1" height="20" width="400">
Thank you for any help, and reading through a long winded request.
This pausing your processing for a period of time to give the system
time to update the browser display. This is commonly done through the
setTimeout (or to a lesser extent the setInterval) functions provided
as part of the browser Document Object Model (DOM). The main feature
needed to make this work is that you process MUST take a break at each
point you want the display to be updated. Then the setTimeout kicks
in after the appropriate timeout and restarts the process. This is
pretty tricky to do and somewhat difficult for some people to
comprehend (it took me more than one try ;o).
Anyway, here is a sample I had laying around that illustrates on way
to do it ...
<html>
<head>
<script language=VBScript>
Sub StepWise(nStage)
Dim nPause
document.body.innerHTML = "Step " & nStage
nPause = 500 ' milliseconds
Select Case nStage
Case 1
setTimeout "StepWise " & nStage + 1, nPause, "VBScript"
Case 2
setTimeout "StepWise " & nStage + 1, nPause, "VBScript"
Case 3
setTimeout "StepWise " & nStage + 1, nPause, "VBScript"
Case 4
setTimeout "StepWise " & nStage + 1, nPause, "VBScript"
Case 5
document.body.innerHTML = "Done"
End Select
End Sub
</script>
</head>
<body onload="StepWise 1">
</body>
</html>
This is structured by stages, which by nature do different things. It
could also be a simple IF block around your whole loop process
instead, sometyhing like this ...
Sub Steps(nStep, nLimit)
Dim nPause
nPause = 50 ' milliseconds for example
if nStep <= nLimit then
' do process
' update progress
document.body.innerHTML = "Step " & nStep
else
GoToNextPartofProcess(Arguments, if, needed)
End Select
End Sub
HTH
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
Why do you say it will add one second per line. It can be set to an
interval large enough to let the display update, but small enough to
minimize its impact.
In addition, you don't have to update the screen after every iteration
through the loop. Set it to happen every 100th time, instead.
Finally, as much as I admire mr unreliable's work, in general, I think
he's wrong about the Refresh. The issue is that your underlying
process is hogging all of the time available, such that the Refresh
can't take effect. Beside that, I think that a refresh should result
in the HTA returning to it's initialized state, that is like it was
just reloaded, not to the state at the time of the refresh. At least,
that's what would happen if you were to press the refresh key (F5) or
select the Refresh menu item in a browser window.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
.
- Follow-Ups:
- Re: HTA - Refresh
- From: JHP
- Re: HTA - Refresh
- References:
- HTA - Refresh
- From: JHP
- Re: HTA - Refresh
- From: Tom Lavedas
- Re: HTA - Refresh
- From: JHP
- HTA - Refresh
- Prev by Date: Re: HTA - Refresh
- Next by Date: Re: HTA - Refresh
- Previous by thread: Re: HTA - Refresh
- Next by thread: Re: HTA - Refresh
- Index(es):
Relevant Pages
|