Abyssmedia.com Forum Index Abyssmedia.com
Abyssmedia Support Forums
 
  FAQ    Search    Memberlist    Usergroups   Register 
  Profile    Log in to check your private messages    Log in 

Progressbar?

 
Post new topic   Reply to topic    Abyssmedia.com Forum Index -> Quick Batch File Compiler
View previous topic :: View next topic  
Author Message
jasell



Joined: 06 May 2008
Posts: 6

PostPosted: Tue Jul 15, 2008 7:22 am    Post subject: Progressbar? Reply with quote

Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)

I'm using winXP.
Back to top
sKurt



Joined: 23 Jul 2007
Posts: 32

PostPosted: Fri Jul 18, 2008 2:24 pm    Post subject: Re: Progressbar? Reply with quote

[quote="jasell"]Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)

I'm using winXP.[/quote]

Try this;

::+===========================================+::

::+==============[ Progress Meter ]=============+
::| 2007_01_10 by rholt |
::| core2quad@rogers.com |
::| This subroutine displays a progress meter in |
::| the titlebar of the current CMD window. |
::| |
::| Input: %1 must contain the current progress |
::| (0-100) |
::| Return: None |
::| |
::| Calculate the number of vertical bars then |
::| spaces based on the percentage value passed |
::+======================================+

:ProgressMeter

SETLOCAL ENABLEDELAYEDEXPANSION
SET ProgressPercent=%1
SET /A NumBars=%ProgressPercent%/2
SET /A NumSpaces=50-%NumBars%

::+=============================+
::| Clear the progress meter image |
::+=============================+

SET Meter=

::+==========================+
::| Build the meter image using vertical bars |
::| followed by trailing spaces |
::| Note there is a trailing space at the end |
::| of the second line below |
::+==========================+

@FOR /L %%a IN (%NumBars%,-1,1) DO (SET Meter=!Meter!I)

@FOR /L %%a IN (%NumSpaces%,-1,1) DO (SET Meter=!Meter!)

::+==========================+
::| Display the progress meter in the title bar |
::| and return to the main program |
::+==========================+

TITLE Progress: [%Meter%] %ProgressPercent%%%
ENDLOCAL
GOTO :EOF

::+===+
::| EOF |
::+===+
Back to top
sKurt



Joined: 23 Jul 2007
Posts: 32

PostPosted: Fri Jul 18, 2008 2:26 pm    Post subject: Re: Progressbar? Reply with quote

jasell wrote:
Is there a special echo-command that can do a progressbar?
I mean print a '.' without a linebreak? (like in unix)

I'm using winXP.



Or This

:: __________________________________________________________________
::
:: Batch File: propy.cmd
:: Author: Frank-Peter Schultze
::
:: Updates: http://www.fpschultze.de/
:: Enhancement Req.
:: And Bug Reports: support@fpschultze.de
::
:: Built/Tested On: Windows XP
:: Requirements:
::
:: Purpose: Copy a file showing a progress bar
::
:: Syntax: propy's syntax corresponds to Windows XP's COPY command.
::
:: State Changes:
::
:: Assumptions And
:: Limitations:
::
:: Last Update: 2005-09-19
:: __________________________________________________________________
::
@Echo Off

If %2!==! (
Echo Copy a file showing a progress bar.
Echo.
Echo %~n0 source target [/copyoptions]
Echo.
Echo source The file^(s^) to be copied.
Echo target The copy destination.
Echo copyoptions Correspond to Windows XP's COPY command options.
Goto :EOF)

SetLocal

::Set flag file
Set propy.FlagFile=%TEMP%\%RANDOM%.tmp

::Set default progress bar character
Set propy.ProgressBarChar=*

::Set default progress bar intervall (seconds)
Set propy.ProgressBarWait=.05

If Exist %propy.FlagFile% Del %propy.Flagfile%
Start /Min Copy %* ^& Echo. ^> %propy.Flagfile% ^& Exit
(Set /P i=Copying %1) < NUL
Set /A propy.ProgressBarWait += 1
:Loop
If Not Exist %propy.Flagfile% (
(Set /P i=%propy.ProgressBarChar%) < NUL
Ping -n %propy.ProgressBarWait% 127.0.0.1 > NUL
Goto Loop)
Del %propy.FlagFile%

EndLocal
Back to top
jasell



Joined: 06 May 2008
Posts: 6

PostPosted: Mon Jul 21, 2008 1:11 pm    Post subject: Reply with quote

Thanks,

I used the first solution, in the second solution its indicated that the delay can be fine tuned, however the ping delay must be integer and one ping attempt takes a couple of secs.
(The delay I use is: ping -n 1 localhost)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Abyssmedia.com Forum Index -> Quick Batch File Compiler All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2011 phpBB Group