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.

Re: HTA - Refresh by mr_unreliable

mr_unreliable
Wed Apr 30 10:07:41 CDT 2008

JHP wrote:
> How do I refresh (repaint) the HTA.
>

hi JHP,

Try this:

document.execCommand("Refresh")

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

Re: HTA - Refresh by Tom

Tom
Wed Apr 30 10:06:45 CDT 2008

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/

Re: HTA - Refresh by JHP

JHP
Wed Apr 30 11:14:07 CDT 2008

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" <tglbatch@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/



Re: HTA - Refresh by JHP

JHP
Wed Apr 30 11:40:15 CDT 2008

How do I embed this into vbScript - with a quick net lookup I see that it's
java. I added it to my code but nothing happends... here is a snippet:

Sub CreateTMP()
Const forWriting = 2
Const createFile = True

Set objRegExp = CreateObject("VBScript.RegExp")
objRegExp.Global = True
objRegExp.IgnoreCase = True
objRegExp.Pattern =
"[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9]"
Set objMatch = objRegExp.Execute(strACHText)
lngRowCount = objMatch.Count

If lngRowCount > 0 Then
strProgress = "<object
classid='clsid:35053A22-8589-11D1-B16A-00C0F0283628' id='ProgressBar1'
height='20' width='400'>"
strProgress = strProgress & "<param name='Min' value='0'>"
strProgress = strProgress & "<param name='Max' value='" & lngRowCount &
"'>"
strProgress = strProgress & "<param name='Orientation' value='0'>"
strProgress = strProgress & "<param name='Scrolling' value='1'>"
strProgress = strProgress & "</object>"
document.getElementById("progress").innerHTML = strProgress
Sleep(1)

For Each rtnMatch In objMatch
strContract = rtnMatch.Value
document.getElementById("contract").innerHTML = "<span>Parsing
Contract: " & strContract & "</span>"

If ProgressBar1.Value < ProgressBar1.Max Then ProgressBar1.Value =
ProgressBar1.Value + 1

document.execCommand("Refresh")
lngStart = rtnMatch.FirstIndex
lngFinish1 = InStr(lngStart, strACHText, vbCrLf)
lngFinish2 = InStr(lngFinish1 + 2, strACHText, vbCrLf) - (lngFinish1 +
2)
strLine1 = Mid(strACHText, lngStart, lngFinish1 - lngStart)
strLine2 = Mid(strACHText, lngFinish1 + 2, lngFinish2)
strTemp = strTemp & Trim(strLine1) & " " & Trim(strLine2) & vbCrLf
Next
strACHFile = Mid(strFolderFile, InStrRev(strFolderFile, "\") + 1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strRoot & Left(strACHFile,
Len(strACHFile) - 3) & "tmp", forWriting, createFile)
objFile.Write strTemp
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Call createExcel()
End If
Set objMatch = Nothing
Set objRegExp = Nothing
End Sub

"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:OtspsLtqIHA.3568@TK2MSFTNGP04.phx.gbl...
> JHP wrote:
>> How do I refresh (repaint) the HTA.
>>
>
> hi JHP,
>
> Try this:
>
> document.execCommand("Refresh")
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)



Re: HTA - Refresh by Tom

Tom
Wed Apr 30 12:50:24 CDT 2008

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/

Re: HTA - Refresh by JHP

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/



Re: HTA - Refresh by Joe

Joe
Thu May 01 05:14:29 CDT 2008

"JHP" <goawayspam@GFY.com> wrote in message
news:OWjpfDuqIHA.3508@TK2MSFTNGP03.phx.gbl...
> How do I embed this into vbScript - with a quick net lookup I see that
> it's java. I added it to my code but nothing happends... here is a
> snippet:
>
> Sub CreateTMP()
> Const forWriting = 2
> Const createFile = True
>
> Set objRegExp = CreateObject("VBScript.RegExp")
> objRegExp.Global = True
> objRegExp.IgnoreCase = True
> objRegExp.Pattern =
> "[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9]"
> Set objMatch = objRegExp.Execute(strACHText)
> lngRowCount = objMatch.Count
>
> If lngRowCount > 0 Then
> strProgress = "<object
> classid='clsid:35053A22-8589-11D1-B16A-00C0F0283628' id='ProgressBar1'
> height='20' width='400'>"
> strProgress = strProgress & "<param name='Min' value='0'>"
> strProgress = strProgress & "<param name='Max' value='" & lngRowCount &
> "'>"
> strProgress = strProgress & "<param name='Orientation' value='0'>"
> strProgress = strProgress & "<param name='Scrolling' value='1'>"
> strProgress = strProgress & "</object>"
> document.getElementById("progress").innerHTML = strProgress
> Sleep(1)
>
> For Each rtnMatch In objMatch
> strContract = rtnMatch.Value
> document.getElementById("contract").innerHTML = "<span>Parsing
> Contract: " & strContract & "</span>"
>
> If ProgressBar1.Value < ProgressBar1.Max Then ProgressBar1.Value =
> ProgressBar1.Value + 1
>
> document.execCommand("Refresh")
> lngStart = rtnMatch.FirstIndex
> lngFinish1 = InStr(lngStart, strACHText, vbCrLf)
> lngFinish2 = InStr(lngFinish1 + 2, strACHText, vbCrLf) - (lngFinish1 +
> 2)
> strLine1 = Mid(strACHText, lngStart, lngFinish1 - lngStart)
> strLine2 = Mid(strACHText, lngFinish1 + 2, lngFinish2)
> strTemp = strTemp & Trim(strLine1) & " " & Trim(strLine2) & vbCrLf
> Next
> strACHFile = Mid(strFolderFile, InStrRev(strFolderFile, "\") + 1)
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFile = objFSO.OpenTextFile(strRoot & Left(strACHFile,
> Len(strACHFile) - 3) & "tmp", forWriting, createFile)
> objFile.Write strTemp
> objFile.Close
> Set objFile = Nothing
> Set objFSO = Nothing
> Call createExcel()
> End If
> Set objMatch = Nothing
> Set objRegExp = Nothing
> End Sub
>
> "mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
> news:OtspsLtqIHA.3568@TK2MSFTNGP04.phx.gbl...
>> JHP wrote:
>>> How do I refresh (repaint) the HTA.
>>>
>>
Not sure why you think that's in java, or JavaScript. Looks like VB(Script)
to me.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name



Re: HTA - Refresh by mayayana

mayayana
Thu May 01 08:06:55 CDT 2008


Another option is to provide some kind of
feedback to let people know the HTA is busy.
In VB there's a DoEvents method that passes
control to Windows just long enough to catch
up with pending system messages, then continues.
It slows things down but works well to keep
screen painting up to date. That's really what
you want, but there's no good way to do it in
script or in IE.

A method I use is to show a small clock icon
and change the cursor while working. It's a bit
clunky, but it serves to inform people of what's
happening and stop them from trying to click
buttons. (After all, no one can do anything
while your function is running anyway, so keeping
the painting refreshed isn't of much value.)

The way this method works is that I put the clock
picture in a table with an ID set to not display:

TABLE.clock {display: none;}

Then I can toggle the display from code.
When I want to show the clock I use:

document.body.style.cursor = "wait"
ShowClock

The ShowClock sub just handles the CSS code to
make the clock visible center-screen, with a high
z-index to put it on top of everything else. Then I
also call a hack version of DoEvents, which is needed
for IE to paint the clock before starting the long
operation that's going to freeze it:

Sub DoEvents()
SH.run "%comspec% /c exit", 0, True
End Sub

(SH is WScript.Shell.)

When the operation is done the HideClock sub just
changes the style display property of the table, to
hide the clock, and returns the cursor to normal.

I don't remember whether I tested this method
successfully on all systems.


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



Re: HTA - Refresh by JHP

JHP
Thu May 01 13:25:01 CDT 2008

Not saying your wrong, but everywhere I search: document.execCommand - runs
Client-Side, and it's always associated to JavaScript:

http://www.google.com/search?complete=1&hl=en&q=document.execCommand+vbscript&aq=f

My response was more to the fact that: document.execCommand("Refresh") did
not work in the context I was using it, and maybe mr_unreliable had a fix :)

"Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
news:epdnlQ3qIHA.1316@TK2MSFTNGP06.phx.gbl...
> "JHP" <goawayspam@GFY.com> wrote in message
> news:OWjpfDuqIHA.3508@TK2MSFTNGP03.phx.gbl...
>> How do I embed this into vbScript - with a quick net lookup I see that
>> it's java. I added it to my code but nothing happends... here is a
>> snippet:
>>
>> Sub CreateTMP()
>> Const forWriting = 2
>> Const createFile = True
>>
>> Set objRegExp = CreateObject("VBScript.RegExp")
>> objRegExp.Global = True
>> objRegExp.IgnoreCase = True
>> objRegExp.Pattern =
>> "[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9]"
>> Set objMatch = objRegExp.Execute(strACHText)
>> lngRowCount = objMatch.Count
>>
>> If lngRowCount > 0 Then
>> strProgress = "<object
>> classid='clsid:35053A22-8589-11D1-B16A-00C0F0283628' id='ProgressBar1'
>> height='20' width='400'>"
>> strProgress = strProgress & "<param name='Min' value='0'>"
>> strProgress = strProgress & "<param name='Max' value='" & lngRowCount
>> & "'>"
>> strProgress = strProgress & "<param name='Orientation' value='0'>"
>> strProgress = strProgress & "<param name='Scrolling' value='1'>"
>> strProgress = strProgress & "</object>"
>> document.getElementById("progress").innerHTML = strProgress
>> Sleep(1)
>>
>> For Each rtnMatch In objMatch
>> strContract = rtnMatch.Value
>> document.getElementById("contract").innerHTML = "<span>Parsing
>> Contract: " & strContract & "</span>"
>>
>> If ProgressBar1.Value < ProgressBar1.Max Then ProgressBar1.Value =
>> ProgressBar1.Value + 1
>>
>> document.execCommand("Refresh")
>> lngStart = rtnMatch.FirstIndex
>> lngFinish1 = InStr(lngStart, strACHText, vbCrLf)
>> lngFinish2 = InStr(lngFinish1 + 2, strACHText, vbCrLf) - (lngFinish1
>> + 2)
>> strLine1 = Mid(strACHText, lngStart, lngFinish1 - lngStart)
>> strLine2 = Mid(strACHText, lngFinish1 + 2, lngFinish2)
>> strTemp = strTemp & Trim(strLine1) & " " & Trim(strLine2) &
>> vbCrLf
>> Next
>> strACHFile = Mid(strFolderFile, InStrRev(strFolderFile, "\") + 1)
>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>> Set objFile = objFSO.OpenTextFile(strRoot & Left(strACHFile,
>> Len(strACHFile) - 3) & "tmp", forWriting, createFile)
>> objFile.Write strTemp
>> objFile.Close
>> Set objFile = Nothing
>> Set objFSO = Nothing
>> Call createExcel()
>> End If
>> Set objMatch = Nothing
>> Set objRegExp = Nothing
>> End Sub
>>
>> "mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
>> news:OtspsLtqIHA.3568@TK2MSFTNGP04.phx.gbl...
>>> JHP wrote:
>>>> How do I refresh (repaint) the HTA.
>>>>
>>>
> Not sure why you think that's in java, or JavaScript. Looks like
> VB(Script) to me.
>
> --
>
> Joe Fawcett (MVP - XML)
>
> http://joe.fawcett.name
>
>



Re: HTA - Refresh by JHP

JHP
Thu May 01 13:28:15 CDT 2008

Thanks for the post... I was using the progress bar as the feedback
solution, it's just that if anything overlaps the window while the long
process was running - the background would loose it's color for the
duration; also screen text would not update until it completed.

"mayayana" <mayaXXyana1a@mindXXspring.com> wrote in message
news:%23hrxxw4qIHA.1228@TK2MSFTNGP05.phx.gbl...
>
> Another option is to provide some kind of
> feedback to let people know the HTA is busy.
> In VB there's a DoEvents method that passes
> control to Windows just long enough to catch
> up with pending system messages, then continues.
> It slows things down but works well to keep
> screen painting up to date. That's really what
> you want, but there's no good way to do it in
> script or in IE.
>
> A method I use is to show a small clock icon
> and change the cursor while working. It's a bit
> clunky, but it serves to inform people of what's
> happening and stop them from trying to click
> buttons. (After all, no one can do anything
> while your function is running anyway, so keeping
> the painting refreshed isn't of much value.)
>
> The way this method works is that I put the clock
> picture in a table with an ID set to not display:
>
> TABLE.clock {display: none;}
>
> Then I can toggle the display from code.
> When I want to show the clock I use:
>
> document.body.style.cursor = "wait"
> ShowClock
>
> The ShowClock sub just handles the CSS code to
> make the clock visible center-screen, with a high
> z-index to put it on top of everything else. Then I
> also call a hack version of DoEvents, which is needed
> for IE to paint the clock before starting the long
> operation that's going to freeze it:
>
> Sub DoEvents()
> SH.run "%comspec% /c exit", 0, True
> End Sub
>
> (SH is WScript.Shell.)
>
> When the operation is done the HideClock sub just
> changes the style display property of the table, to
> hide the clock, and returns the cursor to normal.
>
> I don't remember whether I tested this method
> successfully on all systems.
>
>
>> 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.
>>
>>
>>
>
>



Re: HTA - Refresh by Tom

Tom
Thu May 01 13:48:49 CDT 2008

On May 1, 2:25 pm, "JHP" <goaways...@GFY.com> wrote:
> Not saying your wrong, but everywhere I search: document.execCommand - runs
> Client-Side, and it's always associated to JavaScript:
>
> http://www.google.com/search?complete=1&hl=en&q=document.execCommand+...
>
> My response was more to the fact that: document.execCommand("Refresh") did
> not work in the context I was using it, and maybe mr_unreliable had a fix :)
>
> "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote in message
>
> news:epdnlQ3qIHA.1316@TK2MSFTNGP06.phx.gbl...
{snip}
>
> > Not sure why you think that's in java, or JavaScript. Looks like
> > VB(Script) to me.
>
> > --
>
> > Joe Fawcett (MVP - XML)
>
> >http://joe.fawcett.name

Strictly speaking it is not Java (JScript), but rather a part of the
browser's document object model (DOM) which is language independent.
That is it can be used in JScript or VBS, if the browser supports
those - only IE does both, AFAIK. Plus, I believe IE's DOM is the
only one that supplies the execCommand() method but it's still not
Java. Your observation is probably an artifact of the fact that most
posts are from people using the more universal JScript to better
support a wider set of browsers.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Re: HTA - Refresh by JHP

JHP
Thu May 01 14:06:04 CDT 2008

Thanks very much - knowledge is power... and it helps to know what I'm
talking about :)

"Tom Lavedas" <tglbatch@cox.net> wrote in message
news:ab7b57a1-1628-4f42-86ac-60bca9a33d69@f63g2000hsf.googlegroups.com...
> On May 1, 2:25 pm, "JHP" <goaways...@GFY.com> wrote:
>> Not saying your wrong, but everywhere I search: document.execCommand -
>> runs
>> Client-Side, and it's always associated to JavaScript:
>>
>> http://www.google.com/search?complete=1&hl=en&q=document.execCommand+...
>>
>> My response was more to the fact that: document.execCommand("Refresh")
>> did
>> not work in the context I was using it, and maybe mr_unreliable had a fix
>> :)
>>
>> "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote in message
>>
>> news:epdnlQ3qIHA.1316@TK2MSFTNGP06.phx.gbl...
> {snip}
>>
>> > Not sure why you think that's in java, or JavaScript. Looks like
>> > VB(Script) to me.
>>
>> > --
>>
>> > Joe Fawcett (MVP - XML)
>>
>> >http://joe.fawcett.name
>
> Strictly speaking it is not Java (JScript), but rather a part of the
> browser's document object model (DOM) which is language independent.
> That is it can be used in JScript or VBS, if the browser supports
> those - only IE does both, AFAIK. Plus, I believe IE's DOM is the
> only one that supplies the execCommand() method but it's still not
> Java. Your observation is probably an artifact of the fact that most
> posts are from people using the more universal JScript to better
> support a wider set of browsers.
>
> Tom Lavedas
> ===========
> http://members.cox.net/tglbatch/wsh/



Re: HTA - Refresh by mayayana

mayayana
Thu May 01 19:09:44 CDT 2008

> Thanks for the post... I was using the progress bar as the feedback
> solution,

Woops. I didn't notice that part of your initial post.