DE
Sat Feb 28 10:56:22 CST 2004
Thanks,
The progress bar is nice, however I was looking more
towards what you were doing with the first example except
that I thought there was a way to somehow automatically
refresh the number of seconds text within the box without
event needing user intervention as well as to keep that
box up until process/script activity is complete.
Like I said before, I really doubt that there is a way
without using some kind of IE object like you did with the
second example, but I could of sworn I saw it somewhere.
D
>-----Original Message-----
>Hi,
>
>"DE" <anonymous@discussions.microsoft.com> wrote in
message
>news:057d01c3fe10$7914e450$3a01280a@phx.gbl...
>| Hi,
>|
>| A question I've been thinking of for some time... I am
>| sure I saw the answer somewhere on the web but can't
find
>| it again...
>|
>| I am trying to display a popup box that times out. I
know
>| it can be done with the wscript.shell popup command by
>| just specifying the timeout time as one of the
paramters,
>| however I want some message box to keep updating the
>| amount of time left as text IN the popup box and somehow
>| loop it so it doesn't allow user interaction until the
>| timeout expires. My instinct tells me this can only be
>| done through scripting something with IE (form), but I
am
>| sure I saw this done somewhere with either msgbox or
popup
>| within somekind of a loop to keep updating the
>| msgbox/popup text on the fly. Any help would be great!
>
>If I understand what you're asking for, this may get you
started. The first
>form uses the popup box. The popup refreshes every 2
seconds. The example
>has a 10-second duration. User dismissal simply
refreshes, and the box is
>system-modal. You need to add an exit condition to exit
an indefinite loop.
>
>The second form is an IE progress bar form and is much
smoother. Using use
>kiosk style (reduced fullscreen with larger outset
borders takes care of
>titlebar and taskbar closures, but any IE dialog can be
closed with Alt+F4,
>which cannot be effectively trapped for security
reasons. Since dismissal
>will create an error, the script below simply to traps
the error and
>regenerates the box. Another approach is to use GetRef
to sink an
>OnBeforeUnload event that accomplishes the same thing,
but error-trapping
>seems easier to me. The modified handling code at the
bottom of the sample
>code moves the dialog box to a function to facilitate
regeneration and sets
>up your operational loop. If you want a counter instead
of a bar, simply
>count in the same way as the Popup example, and use
InnerText to insert the
>count into a bordered cell or a read-only input-text
control box.
>
>With either example, try dismissing the box and see what
happens.
>
>---
>Popup
>---
>set oWshShell= createobject("wscript.shell")
>nDisplayTime= 10
>nPopupTime= 2
>nStartTime= timer
>nLapseTime= 0
>
>do
> oWshShell.popup "Elapsed time: " _
> & nLapseTime & " seconds " _
> & vbCr & vbCr & "Please wait ...", _
> nPopupTime, "Title of Box", _
> vbOkOnly +vbInformation +vbSystemModal
>
>' if ... then exit do
>
> nLapseTime= cint(timer -nStartTime)
> if (nLapseTime<0) then
> nStartTime= nStartTime _
> -(60 *60 *24)
> nLapseTime= cint(timer -nStartTime)
> end if
>
>loop while (nLapseTime<nDisplayTime)
>
>msgbox "Process complete. ", _
> vbOkOnly +vbInformation, _
> "Title of Box"
>---
>
>---
>IE Progress Bar
>---
>nScrW= createobject( _
> "htmlfile").parentWindow.screen.availWidth
>nScrHt= createobject( _
> "htmlfile").parentWindow.screen.availHeight
>
>showBar oIe
>wscript.sleep 1000
>
>oIe.document.parentWindow.document.script.barop 0
>
>do 'your operational loop
>
>' ...
>
>iPct= iPct +1 'or whatever increment
>
>on error resume next
> oIe.document.parentWindow.document.script.barop iPct
> if err then
> err.clear
> showBar oIe
> oIe.document.parentWindow.document.script.barop iPct
> end if
>on error goto 0
>
>loop until (iPct=100)
>
>wscript.sleep 1000
>wscript.echo "Script is complete."
>
>oIe.quit
>wscript.quit
>
>function showBar (oIe)
>
>set oIe= createobject( _
> "internetExplorer.application")
>oIe.navigate("about:blank")
>do: wscript.sleep 50: loop until oIe.readyState=4
>
>with oIe
> .fullScreen= true
> .toolbar = false
> .statusBar = false
> .addressBar = false
> .resizable= false
> .width= 420
> .height= 120
> .left= (nScrW -420) \2
> .top= (nScrHt -120) \2
>
> with .document
> .writeLn ("<!doctype html public>")
> .writeLn ("<html style=""border-style:outset;" _
> & "border-width:4px"">")
> .writeln ("<head>")
> .writeLn ("<title>Progress Bar Demo</title>")
> .writeln ("<style type=""text/css"">")
> .writeln ("body {background-color:#ece9d8;" _
> & "text-align:center;vertical-align:middle}")
> .writeln ("</style>")
> .WriteLn ("<script language=""vbscript"">")
> .writeln ("function BarOp (vnPct)")
> .writeln ("window.bar.style.width= vnPct
& ""%""")
> .writeln ("end function")
> .writeln ("</script>")
> .writeln ("</head>")
> .writeln ("<body scroll=""no"">")
> .writeln ("<table>")
> .writeln ("<tr>")
> .writeln ("<td style=""text-align:center;" _
> & "font-family:Arial;font-size:16pt;" _
> & "font-weight:bold"">")
> .writeln ("Progress Bar Demo")
> .writeln ("</td>")
> .writeln ("</tr>")
> .writeln ("<tr>")
> .writeln ("<td id=""barcell"" " _
> & "style=""width:400px;padding-left:7px;" _
> & "padding-right:7px;text-align:left;" _
> & "border-style:inset;border-width:thin;" _
> & "background-color:navajowhite"">")
> .writeln ("<hr id=""bar"" " _
> & "style=""width:0%;height:15px;" _
> & "color:darkblue"" />")
> .writeln ("</td>")
> .writeln ("</tr>")
> .writeln ("</table>")
> .writeln ("</body>")
> .writeln ("</html>")
> end with
>end with
>
>oIe.Visible= True
>
>end function
>---
>
>Joe Earnest
>
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (
http://www.grisoft.com).
>Version: 6.0.564 / Virus Database: 356 - Release Date: 01-
19-04
>
>
>.
>