Two version for this ProgressBar:
1/ for small number of items to proceed (less than 50).
The lenght (or number of steps) of the bar is proportional to the number of items
2/ for large numbers of items (more than 50)
The lenght of the bar is 50.
---
- Displays percents in the taskbar and the caption
- Diplay numbers of done items and the total.
- "classic" because of the greyish background, of course you can change the colors: white will make it Windows 3.1 style, blue and yellow: BSOD style etc)
---
To use them in a useful manner, you will have to figure out how to feed the "x" variable to the progress bar. You can either include the prgressbar code into an hta application (progress shown on the main window) or make it read a file generated by the main scrit with the datas needed for the progressbar.
This code can be easily modified to add extra infos, colors, them, pictures etc
---
1/ for small number of items to proceed (less than 50).
The lenght (or number of steps) of the bar is proportional to the number of items
<html>
<head>
<title id="title">Zzzzz</title>
<HTA:APPLICATION
ID="ProgressBar"
APPLICATIONNAME="ProgressBar"
SCROLL="no"
MAXIMIZEBUTTON="no"
/>
<SCRIPT Language="VBScript">
Public x, y, MyTitle
Sub Window_Onload
window.resizeTo 436,116
y=5
MyTitle = " _ Zzzz"
window.setInterval "Progress", 150
End Sub
Sub Progress
x=x+1
document.Title = FormatPercent(x/y, 0) & MyTitle
document.all.ProgBarText.innerText = x & "/" & y
document.all.ProgBarDone.innerText = String(x, "_")
document.all.ProgBarToDo.innerText = String(y-x, "_") & "|"
If x=y Then
document.all.ProgBarToDo.innerText = ""
MsgBox "ok"
window.close
End If
End Sub
</SCRIPT>
</head>
<body bgcolor="#D7D7D7">
<span id="ProgBarText"></span><br>
<span id="ProgBarDone" style="background-color: #3399FF"></span>
<font color="#FFFFFF">
<span id="ProgBarToDo"style="background-color: #C0C0C0"></span>
</font>
</body>
</html>
2/ for large numbers of items (more than 50)
The lenght of the bar is 50.
<html>
<head>
<title id="title">Zzzzz</title>
<HTA:APPLICATION
ID="ProgressBar"
APPLICATIONNAME="ProgressBar"
SCROLL="no"
MAXIMIZEBUTTON="no"
/>
<SCRIPT Language="VBScript">
Public w,x,y, MyTitle
'-- w: bar width, x: done items, y: remaining items
Sub Window_Onload
window.resizeTo 440,116
w=50
y=1352
MyTitle = " _ Zzzz"
window.setInterval "Progress", 150
End Sub
Sub Progress
x=x+27
d = Round( x / (y/w) +1 ,0)
document.Title = FormatPercent(x/y, 0) & MyTitle
document.all.ProgBarText.innerText = x & "/" & y
document.all.ProgBarDone.innerText = String(d, "_")
If d<w Then
document.all.ProgBarToDo.innerText = String(w-d, "_") & "|"
Else
document.all.ProgBarToDo.innerText = "|"
End If
If x>=y Then
document.all.ProgBarToDo.innerText = ""
MsgBox "ok"
window.close
End If
End Sub
</SCRIPT>
</head>
<body bgcolor="#D7D7D7">
<span id="ProgBarText"></span><br>
<span id="ProgBarDone" style="background-color: #3399FF"></span>
<font color="#FFFFFF">
<span id="ProgBarToDo"style="background-color: #C0C0C0"></span>
</font>
</body>
</html>