Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
GoSub defineFunctions :begin ; test the progress bar udfBoxProgressOpen("Sample progress bar","","","",0) ;initialize the progress bar For x = 1 To 40 percentComplete = ((x*1.0/40)*100) currFile = FileCreateTemp("{{{") udfBoxProgressUpdate("Creating files:",currFile,"Please be patient...",percentComplete) TimeDelay(0.1) Next ;x udfBoxProgressUpdate("Deleting files:","","",100) TimeDelay(1) DirChange(Environment("TEMP")) FileDelete("{{{*") BoxShut() ;close box progress bar with boxShut. Didn't feel it worth to write a udf for that :) Exit :defineFunctions ;-------------------- udfBoxProgressOpen -------------------- ; in: title, firstLine, secondLine, thirdLine, percentComplete ; out: @TRUE/@FALSE ; depends: ; description: takes parameters and sets up a boxText-based progress bar #DefineFunction udfBoxProgressOpen(title,firstLine,secondLine,thirdLine,percentComplete) IntControl(73,1,0,0,0) ;goto wberrorhandler upon errors percentComplete = Int(percentComplete) ;make sure percent is an integer. leadSpace = StrFill(" ",8) statusText = StrCat(firstLine,@CRLF,secondLine,@CRLF,thirdLine,@CRLF,@CRLF) progressBarTop = StrCat(leadSpace,StrFill("_",50),@CRLF) progressBar = StrCat(leadSpace,StrFill("€",percentComplete),@CRLF) progressBarBottom = StrCat(leadSpace,StrFill("¯",50),@CRLF) progressBarPercent = StrCat(StrFill(" ",56),percentComplete,"%%") progressBarText = StrCat(progressBarTop,progressBar,progressBarBottom,progressBarPercent) body = StrCat(statusText,progressBarText) BoxOpen(title,body) Return @TRUE :WBERRORHANDLER Return @FALSE #EndFunction ;-------------------- END udfBoxProgressOpen ;-------------------- udfBoxProgressUpdate -------------------- ; in: firstLine,secondLine,thirdLine,percentComplete ; out: @TRUE/@FALSE ; depends: ; description: takes parameters and updates a boxText-based progress bar (udfBoxProgressOpen) #DefineFunction udfBoxProgressUpdate(firstLine,secondLine,thirdLine,percentComplete) IntControl(73,1,0,0,0) ;goto wberrorhandler upon errors percentComplete = Int(percentComplete) ;make sure percent is an integer. leadSpace = StrFill(" ",8) statusText = StrCat(firstLine,@CRLF,secondLine,@CRLF,thirdLine,@CRLF,@CRLF) progressBarTop = StrCat(leadSpace,StrFill("_",50),@CRLF) progressBar = StrCat(leadSpace,StrFill("€",percentComplete),@CRLF) progressBarBottom = StrCat(leadSpace,StrFill("¯",50),@CRLF) progressBarPercent = StrCat(StrFill(" ",56),percentComplete,"%%") progressBarText = StrCat(progressBarTop,progressBar,progressBarBottom,progressBarPercent) body = StrCat(statusText,progressBarText) BoxText(body) Return @TRUE :WBERRORHANDLER Return @FALSE #EndFunction ;-------------------- END udfBoxProgressUpdate Return
Article ID: W16391
File Created: 2005:02:18:12:20:18
Last Updated: 2005:02:18:12:20:18