Show progress bar 
Author Message
 Show progress bar

I want to be able to show a standard windows progress bar or gui when my script
runs. I.E., when I am copying a bunch of files, the progress bar will show how
far along I am and how many percent complete.


Sat, 23 Aug 2003 02:44:35 GMT  
 Show progress bar
Here is a basic way of doing it.

'
'Start of script
'
On Error Resume Next
Dim IE, Counter
Counter = 1
'
' Display IE status window
'
Call CreateIE()
' rest of script here
For I = 1 to 10
  Increment ' sub to increment to percentage complete table
  Wscript.Echo I * 10 & "% Complete"
Next
set myDoc = IE.document.all("message")
myDoc.innerTEXT = "Script Complete"

'End of script
Sub CreateIE()
  On Error Resume Next
  Set IE = CreateObject("InternetExplorer.Application")
  ie.height=150
  ie.width=470
  ie.menubar=0
  ie.toolbar=0
  ie.navigate "c:\scripts\progress.htm"
  ie.visible=1
  Do while ie.Busy
    ' wait for page to load, better to use a COM object to wait
  Loop
End Sub

Sub Increment()
If Counter < 11 Then
  set myDoc = IE.document.all("t" & Counter)
  myDoc.setAttribute "bgColor","Blue"
    Counter = Counter + 1
End If
End Sub
Here is the HTML page (progress.htm)...
<CENTER><TABLE border=1 width=420>
<TR><TD><TABLE border=0 width=400>
<TR><TD bgColor=white id=t1 width="10%"> </TD>
<TD bgColor=white id=t2 width="10%"> </TD>
<TD bgColor=white id=t3 width="10%"> </TD>
<TD bgColor=white id=t4 width="10%"> </TD>
<TD bgColor=white id=t5 width="10%"> </TD>
<TD bgColor=white id=t6 width="10%"> </TD>
<TD bgColor=white id=t7 width="10%"> </TD>
<TD bgColor=white id=t8 width="10%"> </TD>
<TD bgColor=white id=t9 width="10%"> </TD>
<TD bgColor=white id=t10 width="10%"> </TD>
</TR></TABLE></TD></TR></TABLE>
<P id=message>Please Wait, Running Script</P>
</CENTER>

You can also find some other examples at
http://home.att.net/~wshvbs/index.htm
Regards,
Ian
WSH FAQ http://www.windows-script.com



Sat, 23 Aug 2003 03:45:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Scroll a text file and show progress bar (%)

2. can't show Progress Bar on form in IE4

3. How do I display a progress bar showing progress for database replication

4. How do I display a progress bar showing progress for database replication

5. Show a progress bar in the Status Bar

6. How to show progress bar while other code is executing??

7. How to show status window/progress bar

8. Progress bar showing after the page is loaded

9. Need progress bar to show when db is compacted

10. Showing the % done on a progress bar...

11. Get Filelength of long file as it is being created - to show in progress bar

12. Need progress bar to show when db is compacted

 

 
Powered by phpBB® Forum Software