itnifl
asked on
Terminal progressbar in vbs vbscript
This is a progressbar. The script is run with cscript.
progtressMax is defined outside the function and is global. For instance 30.
The problem is that I am not able to clear the screen at the start of the function. So the progressbar floods the screen without making any sense.
Is there a better way to make a terminal progressbar? I don't want html and I don't want popups. Is there a way that works to clear the screen? Please don't post links to other pages of code unless you have tested and verified that it works. The above code for clearing does not work, and there are several examples out there of code that does not work.
progtressMax is defined outside the function and is global. For instance 30.
Function DisplayProgress(progressNumber)
On Error Resume Next
Dim percentDone, percentLeft, intCount
'oShell.SendKeys "CLS + {ENTER}"
oShell.Run "cls"
progressCount = progressCount + progressNumber
wScript.StdOut.Write("|")
percentDone = round((progressCount / progressMax) * 100)
For intCount = 0 To percentDone
wScript.StdOut.Write(".")
Next
percentLeft = round(100-((progressCount / progressMax) * 100))
For intCount = 0 To percentLeft
wScript.StdOut.Write("_")
Next
wScript.StdOut.Write("|")
End Function
The problem is that I am not able to clear the screen at the start of the function. So the progressbar floods the screen without making any sense.
Is there a better way to make a terminal progressbar? I don't want html and I don't want popups. Is there a way that works to clear the screen? Please don't post links to other pages of code unless you have tested and verified that it works. The above code for clearing does not work, and there are several examples out there of code that does not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER