Flash task bar button

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Calvogalatra
Posts: 7
Joined: 31 May 2010 15:35

Flash task bar button

#1 Post by Calvogalatra » 31 May 2010 21:15

Hi

I have a cmd window with several commands running. What i have to do is basically notify user when a process is finished. So I came up with the idea of use this orange flash msn uses. But how to do it from a cmd or a batch file?

Any idea?

Thanks
Calvo

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Flash task bar button

#2 Post by aGerman » 01 Jun 2010 11:02

No, this doesn't work. You could pop up message boxes using an included small VBScript. Or you could run something like a progress bar in a separate batch window. What would you prefer?

Regards
aGerman

Calvogalatra
Posts: 7
Joined: 31 May 2010 15:35

Re: Flash task bar button

#3 Post by Calvogalatra » 01 Jun 2010 22:27

Hi aGerman

Thanks for replying.

I know how to send messages (msg) but i thought this way was better. What about a progress bar, how would you do that?

Thx
Calvo

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Flash task bar button

#4 Post by aGerman » 02 Jun 2010 11:17

I wrote a small example for. It's tested only on XP.
There are some explanations into the code, I hope you will know what you have to change.
It is important that you set the number of steps (pbCalcBase) and that you call the subroutine :pb after each step in your code.

Code: Select all

@echo off &setlocal

:: ************************ progress bar settings !!change it!! **************************
:: sum of steps:
set pbCalcBase=5
:: back- and foreground color (HEX 0 - F):
set pbColor=4E
:: title:
set pbTitle=Progress:
:: ***************************************************************************************

:: ######################### !!don't change anything!! ###################################
set rdm=%random%%random%
set tempdat=progbar%rdm%.dat
set tempbat=%temp%\progbar%rdm%.bat
if not defined pbCalcBase pause>nul|set /p "=Error" &exit
set /a pbCalcBaseNum=%pbCalcBase%
if not "%pbCalcBaseNum%"=="%pbCalcBase%" pause>nul|set /p "=Error" &exit
if %pbCalcBaseNum% leq 0 pause>nul|set /p "=Error" &exit
if not defined pbColor set pbColor=90 &goto forward
set pbColor=%pbColor:~0,2%
set pbColorB=%pbColor:~0,1%
set pbColorF=%pbColor:~-1%
if %pbColorB%==%pbColorF% set pbColor=90
:forward
>%tempbat% echo @echo off ^&setlocal enabledelayedexpansion ^&color %pbColor% ^&mode con cols=108 lines=3
>>%tempbat% echo chcp 437^>nul
>>%tempbat% echo set /a x=0
>>%tempbat% echo set /a n=%%1
>>%tempbat% echo title %pbTitle% 0 %%%%
>>%tempbat% echo echo    0%%%%       10%%%%       20%%%%       30%%%%       40%%%%       50%%%%       60%%%%       70%%%%       80%%%%       90%%%%       100%%%%
>>%tempbat% echo echo    ÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅÂÂÂÂÅ
>>%tempbat% echo ^<nul set /p "=   "
>>%tempbat% echo :loop
>>%tempbat% echo set /p progbar=^<%%temp%%\%%2
>>%tempbat% echo if %%progbar%% gtr %%n%% goto loop
>>%tempbat% echo set /a progbar=%%progbar%%*100/%%n%%
>>%tempbat% echo if %%x%% geq 100 ^(
>>%tempbat% echo  ping -n 2 127.0.0.1 ^>nul
>>%tempbat% echo  if exist %%temp%%\%%2 del %%temp%%\%%2
>>%tempbat% echo  if exist %%0 del %%0
>>%tempbat% echo  exit
>>%tempbat% echo ^)
>>%tempbat% echo if "%%old%%"=="%%progbar%%" ^(
>>%tempbat% echo  ping -n 1 127.0.0.1 ^>nul
>>%tempbat% echo  goto loop
>>%tempbat% echo ^) else ^(
>>%tempbat% echo  set old=%%progbar%%
>>%tempbat% echo  call :sub
>>%tempbat% echo  goto loop
>>%tempbat% echo ^)
>>%tempbat% echo :sub
>>%tempbat% echo set /a y=%%progbar%%-%%x%%
>>%tempbat% echo for /l %%%%a in ^(1,1,%%y%%^) do ^(
>>%tempbat% echo set /a x=!x!+^1
>>%tempbat% echo title %pbTitle% !x! %%%%
>>%tempbat% echo ^<nul set /p "="
>>%tempbat% echo ^)
>>%tempbat% echo goto :eof
echo 0 >%temp%\%tempdat%
start %tempbat% %pbCalcBase% %tempdat%
call :code
ping -n 2 127.0.0.1 >nul
if exist %tempbat% del %tempbat%
if exist %temp%\%tempdat% del %temp%\%tempdat%
exit
:pb
set /a pbn+=1
echo %pbn% >%temp%\%tempdat%
goto :eof
:code
:: #######################################################################################

:: *************************** Work Code !!change it!! ***********************************
:: substitude your code here
:: this 5 pings are only an example
:: call :pb after each step to change the progress bar

title ~~~ 5 Steps ~~~

echo ~~~ 1. Step ~~~
ping -n 3 127.0.0.1
echo.
echo.
call :pb

echo ~~~ 2. Step ~~~
ping -n 3 dostips.com
echo.
echo.
call :pb

echo ~~~ 3. Step ~~~
ping -n 3 google.com
echo.
echo.
call :pb

echo ~~~ 4. Step ~~~
ping -n 3 wikipedia.com
echo.
echo.
call :pb

echo ~~~ 5. Step ~~~
ping -n 3 youtube.com
echo.
echo.
call :pb

:: ***************************************************************************************

Regards
aGerman

Calvogalatra
Posts: 7
Joined: 31 May 2010 15:35

Re: Flash task bar button

#5 Post by Calvogalatra » 17 Apr 2015 14:41

Hi, sorry for the (very) late reply, This is very useful. thanks :)

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Flash task bar button

#6 Post by Squashman » 17 Apr 2015 15:34

Calvogalatra wrote:Hi, sorry for the (very) late reply, This is very useful. thanks :)

You should have waited another 6 weeks to make it an even 5 years and on my birthday!

Calvogalatra
Posts: 7
Joined: 31 May 2010 15:35

Re: Flash task bar button

#7 Post by Calvogalatra » 17 Apr 2015 15:43

lol
I will comeback again in 5 weeks :P

Post Reply