JHP
Wed Apr 30 14:05:42 CDT 2008
I see your point - I don't want it to reload the hta just refresh the
page...
Thank you for following up - I'm going to implement your idea - I may be
able to get away with little to no impact... Thanks!
"Tom Lavedas" <tglbatch@cox.net> wrote in message
news:f7e88ed3-15db-48c4-bb2a-3917245c9b3c@a23g2000hsc.googlegroups.com...
> On Apr 30, 12:14 pm, "JHP" <goaways...@GFY.com> 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...@cox.net> wrote in message
>>
>> news:23fcad21-b73c-483d-bf39-679a34be94ab@z72g2000hsb.googlegroups.com...
>>
>> > On Apr 30, 9:33 am, "JHP" <goaways...@GFY.com> 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/