Login | |
|
 |
RE: HTML status page with counter - 12/15/2006 4:03:10 AM
|
|
 |
|
| |
esnmb
Posts: 452
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
|
''''''''''''''''''Creates an Internet Explorer instance to display script status ''''''''''''''''''' Set objExplorer = Wscript.CreateObject("InternetExplorer.Application", "IE_") objExplorer.Navigate "about:blank" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Top = 180 objExplorer.Left = 200 objExplorer.Width = 630 objExplorer.Height = 320 objExplorer.Visible = 1 objExplorer.Resizable = 0 Do While (objExplorer.Busy) Wscript.Sleep 250 Loop 'Defines HTML code for status window Set objDocument = objExplorer.Document objDocument.Open objDocument.Writeln "<html><head><title>^^ Status Window^^</title></head>" objDocument.Writeln "<style type=""text/css"">body {background-color: #FFFFFF;}"_ & ".style2 {font-family: Arial, Helvetica, sans-serif;font-size: 10.5pt;color: "_ & "#CC6600;font-weight: bold;}.style3 {font-family: Arial, Helvetica, sans-serif}"_ & "body,td,th {font-family: Arial, Helvetica, sans-serif;}</style></head><body>" objDocument.body.style.cursor = "Wait" objDocument.Writeln "<p class=""style2""><B>Collecting Folder Sizes... If IE seems hung, give it a moment...<br>" objDocument.Writeln "</B><i>If this window is closed the script will terminate.</i><br>" objDocument.Writeln "<br>Please be patient...</p>" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' x = 0 ' ---------- Your code here For i = 0 To 100 Wscript.Sleep 200 objDocument.Write "<H3 id=myH1 onChange=""this.innerHTML='" & x & "'"">" & x & "</H3>" x = x + 1 Next 'Completes HTML code for status window and closes it. objDocument.Writeln "<p class=""style2"">Finished!</p>" objDocument.body.style.cursor = "Default" objDocument.Writeln "</body></html>" objDocument.Writeln() objDocument.Close 'Sub to quit the script if IE is closed. Sub IE_onQuit() Wscript.Quit End Sub
|
|
| |
|
|
|
 |
RE: HTML status page with counter - 12/15/2006 5:28:06 AM
|
|
 |
|
| |
TNO
Posts: 1398
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: online
|
make part=0, whole=total files and change part=part+10 to +1 instead and call Sample() Its just a proof of concept, the code could be ALOT prettier. I just wanted to show the basics of a sleek looking loading bar
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: HTML status page with counter - 12/15/2006 6:17:19 AM
|
|
 |
|
| |
TNO
Posts: 1398
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: online
|
hmm, you're going to need the total files to determing the correct %. Somehwere in your code you could increment the total count before hand right? If you're manipulating the files in some way, then you have a means of getting how many there are. For Each File In Folder totalcount=totalcount+1 or something.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: HTML status page with counter - 12/15/2006 6:42:12 AM
|
|
 |
|
| |
TNO
Posts: 1398
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: online
|
correct
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: HTML status page with counter - 12/15/2006 8:08:30 AM
|
|
 |
|
| |
TNO
Posts: 1398
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: online
|
You could create an array and append the fullpath of each file to it instead of copy, then at the very end iterate the array to get the total count, and copy
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: HTML status page with counter - 12/15/2006 8:13:16 AM
|
|
 |
|
| |
TNO
Posts: 1398
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: online
|
I assume your code is designed somthing like this: Sub blah do some stuff copy files End Sub Sub blah do some stuff copy files End Sub Sub blah do some stuff copy files End Sub Sub blah do some stuff copy files End Sub If so, then what I meant by my last post is, do something like this instead: MyArray=blah() Sub blah do some stuff Add file paths to Array End Sub Sub blah do some stuff Add file paths to Array End Sub Sub blah do some stuff Add file paths to Array End Sub Sub blah do some stuff Add file paths to Array End Sub Get size of array for total count part = current count in array for each item in array, update progress bar, copy file hope this helps
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
|
|