Machines And You Headline Animator

Machines And You

NEW

Follow us for more. Know more about mobile phones or Computers. Click here to register to our official web site.

Search This Blog

Saturday 14 May 2011

Make Your Own Countdown Timer





Follow us for more. Click here to register to our official web site.



Hi friends,
 
Today I am here to give you all the process of making a Countdown
Timer.  This application can count days, hours, minutes and seconds.
This would be very useful as you do not need install any softwares. 

 
This is very easy to make since I have provided you with the coding. 
 
IMPORTANT INSTRUCTIONS :
  • Copy the text given below in the scrollbox.
  • Make a new Text file by clicking on Start >
     All Programs > Accessories > Notepad.
  • Paste the entire code in the new text document.
  • Click on File > Save As > Change "Save As Type" 
    to "All Files".
  • Give the file name Hit The Timer.bat
    [N.B.: Do not forget to give the extension as .bat]
  • Click on Save.
  • Now double-click to Play the game. 


@echo off
setlocal enabledelayedexpansion
if /i "%1"=="lol" (goto secondaryrun)
if /i NOT "%1"=="" (
set input=%1 %2 %3 %4 %5
goto gotinput
)
:Firstrun
echo.
echo Enter how many seconds, minutes, hours and days should be waited
echo Add switch "/b" to make the timer run in the background, with no open window
echo Syntax: [/S:Seconds] [/M:Minutes] [/H:Hours] [/D:Days] [/b]
set /p input=""
if not defined input (
cls
goto Firstrun
)
:gotinput
for %%I in (%0) do set filename=%%~sI
for /f "tokens=1,2,3,4,5" %%I in ("%input%") do set input1=%%I& set input2=%%J& set input3=%%K& set input4=%%L& set input5=%%M
echo Now enter the command to be executed when the time runs out
set /p wtd=
echo.
echo Setting up...

set x=0
set fv=/S:
set VN=Seconds
call :sort

set /a seconds=%seconds:~3%
if not defined seconds (set seconds=0)
if /i not %seconds% leq 99 (set seconds=0)
if /i not %seconds% gtr 0 (set seconds=0)

set x=0
set fv=/M:
set VN=Minutes
call :sort

set /a minutes=%minutes:~3%
if not defined minutes (set minutes=0)
if /i not %minutes% leq 99 (set minutes=0)
if /i not %minutes% gtr 0 (set minutes=0)

set x=0
set fv=/H:
set VN=Hours
call :sort

set /a hours=%hours:~3%
if not defined hours (set hours=0)
if /i not %hours% leq 99 (set hours=0)
if /i not %hours% gtr 0 (set hours=0)

set x=0
set fv=/D:
set VN=Days
call :sort

set /a days=%days:~3%
if not defined days (set days=0)
if /i not %days% leq 99 (set days=0)
if /i not %days% gtr 0 (set days=0)

set x=0
set fv=/b
set VN=invis
call :sort

if /i "%invis%" neq "/b" (
set invis=
)

goto gotsecs

:Sort
set /a x= %x% + 1
echo !input%x%! | find /i "%fv%" >nul
if /i %errorlevel% equ 0 (
set %VN%=!input%x%!
exit /b
)
if %X%==5 (
exit /b
)
goto sort



:invismaker
set randomnumber=%random%
for /f "delims=" %%J in ("CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False") do echo %%~J > %temp%\%randomnumber%waiting.temp
echo %wtd% > %temp%\%randomnumber%wtd.temp
Wscript.exe //e:vbscript "%temp%\%randomnumber%waiting.temp" "%filename% lol %counter% %randomnumber%"
del %temp%\%randomnumber%waiting.temp
echo.
echo Timer Running.
exit /b


:gotsecs
Set OriginalTime=%time%
set /a counter= %seconds% + ( %minutes% * 60 ) + ( %hours% * 3600 ) + ( %days% * 86400 )
if /i %counter% equ 0 goto finish
set checktime= %time:~7,1%
if defined invis (
goto invismaker
)
goto timecheck

:secondaryrun
set checktime= %time:~7,1%
set counter=%2
set randomnumber=%3
for /f "delims=" %%I in (%temp%\%randomnumber%wtd.temp) do set wtd=%%I
del %temp%\%randomnumber%wtd.temp

:Timecheck
if /i %checktime% equ %time:~7,1% (goto timecheck)
Set /a counter= %counter% - 1
set /a checktime= %time:~7,1%
goto display


:display
set /a daysremaining= %counter% / 86400
if /i daysremaining GEQ 10 (
set /a daysremaining= %daysremaining:~0,2%
) ELSE (
set /a daysremaining= %daysremaining:~0,1%
)

set /a hoursremaining= ( %counter% - ( %daysremaining% * 86400 ) ) / 3600
if /i hoursremaining GEQ 10 (
set /a hoursremaining= %hoursremaining:~0,2%
) ELSE (
set /a hoursremaining= %hourssremaining:~0,1%
)

set /a minutesremaining= ( %counter% - ( %daysremaining% * 86400 ) - ( %hoursremaining% * 3600) ) /60
if /i minutesremaining GEQ 10 (
set /a minutesremaining= %minutesremaining:~0,2%
) ELSE (
set /a minutesremaining= %minutesremaining:~0,1%
)

Set /a secondsremaining= %counter% - ( %hoursremaining% * 3600 ) - ( %minutesremaining% * 60 ) - ( %daysremaining% * 86400 )


cls
Echo Started Waiting...
Echo Days Remaining: %daysremaining%
Echo Hours Remaining: %hoursremaining%
Echo Minutes Remaining: %Minutesremaining%
Echo Seconds Remaining: %secondsremaining%
if /i %counter% equ 0 (goto finish)
Echo To Pause Timer, Press Pause Break, to resume press Enter.
goto Timecheck

:finish
Set Endtime=%time%
echo Time Waited: %days% Days, %hours%:%Minutes%:%Seconds%
echo Start Time: %OriginalTime:~0,8%
Echo End Time: %Endtime:~0,8%


%wtd%
exit /b
 
 
Thank You for Visiting. Came back for more.
Comment.
Follow.
Share.
Enjoy ..!! 

No comments:

Post a Comment