[title][percentage complete][graphical bar].
Ideal when you have scripts that wade through large databases and take several minutes to complete. The output looks something like this ... Writing to file... [65%] [|||||||||| ]
Sub ProgressBar(Message As String,TotalCount As Integer,ActualCount As Integer)
'Divide the total into 40 equal segments and display
Divisions=Round(TotalCount/40,0)
NoSegments=Round(ActualCount/Divisions,0)+1
'Create the number of boxes
OutputBoxes=""
For i=1 To NoSegments
OutputBoxes=OutputBoxes+Chr(7)
Next
For i=NoSegments To 40
OutputBoxes=OutputBoxes+" "
Next
'Display Percentage
Percentage=Trim(Str(Round((ActualCount/TotalCount*100),0)))
If Len(Percentage)=1 Then Percentage="[ "+Percentage+"%]"
If Len(Percentage)=2 Then Percentage="[ "+Percentage+"%]"
If Len(Percentage)=3 Then Percentage="["+Percentage+"%]"
'Create Output Display
If ActualCount >= TotalCount Then
Print "" 'This clears the message at the end of the run
Else
Print Message+" "+Percentage+" ["+OutputBoxes+"]"
End If
End Sub
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
This was first published in November 2000