On this other matter, this is how I thought a real work progress bar would work. I guess there are two ways of doing this.1) Wrap the progress loop around your work
2) Call a progress function from "within" your work
This example takes the second approach and demonstrates how one might step through a script...
I encapsulated the progressbar variables within the function itself for ease of portability;. One can move them out for effecientcy if one desires !
Plus - I made the bar 50 chars wide for simplicity sake !
code:
break on
$pbPercent = 0
$pbMessage = "Enumerating Groups ..."
gosub pbUpdate
sleep 3 ; enumerate groups here
$pbPercent = 25
$pbMessage = "Mapping Drives ..."
gosub pbUpdate
sleep 3 ; map the drives
$pbPercent = 50
$pbMessage = "Changing the Registry ..."
gosub pbUpdate
sleep 3 ; change the registry ...
$pbPercent = 75
$pbMessage = "Resting for three seconds ..."
gosub pbUpdate
sleep 3 ; rest
$pbPercent = 100
$pbMessage = "Have a nice day ..."
gosub pbUpdate
sleep 3
exit
bUpdate
; place bar with $pbRow and $pbCol
$pbRow = 20
$pbCol = 1
$pbWidth = 50
$pbPattern = "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"
$pbPadding = " "
if $pbPercent
at($pbRow,$pbCol+1) substr("$pbMessage$pbPadding",1,$pbWidth)
at($pbRow+2,$pbCol+2) substr($pbPattern,1,$pbPercent/2)
else
cls
at($pbRow,$pbCol+1) substr("$pbMessage$pbPadding",1,$pbWidth)
box($pbRow+1,$pbCol,$pbRow+3,$pbCol+$pbWidth+3,"single")
at($pbRow+2,$pbCol+2)
endif
return
Shawn.