Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

progresscounter and progressbar

Jun
22
0
To give the response of working to the user in batchfiles which have a longer execution time you can display a progressbar or a progresscounter. I have them in a file called "util.btm" and call them this way:

do i = 0 to 100
gosub "util" display_progressbar 0 %i 100
enddo

Here the scripts:

:progresscounter [start current end]
iff %end le %start then
set xxx=%end
set end=%start
set start=%xxx
unset xxx
endiff
if not %current ge %start .and. not %current le %end return 0

set total=%@eval[%end - %start]
set done=%@eval[%current - %start]
set progress=%@eval[%done / %@max[1,%total]]
return %@int[%@eval[%progress * 100]]


:display_progresscounter [start current end]
set sd1=%_expansion
setdos /x0
gosub progresscounter %start %current %end
set ret=%_?
setdos /a1
echos ^e[s %ret ^% ^e[u
setdos /a0
setdos /x-%sd1
return


:display_progressbar [start current end]
set len=75
set sd1=%_expansion
setdos /x0
gosub progresscounter %start %current %end
set ret=%_?
setdos /a1
echos ^e[s %@repeat[²,%@int[%@eval[%ret / 100 * %len]]]%@repeat[°,%@eval[%len - %@int[%@eval[%ret / 100 * %len]]]] ^e[u
setdos /a0
setdos /x-%sd1
return


Of course you can change the "len" variable as well as the two repeated bar-characters.
 
WoW that's work perfect but where or How I put my own script. I try in differents areas but the result it's not correct. Can U tell me, please!
 
Back
Top