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

Showing posts with label Applications. Show all posts
Showing posts with label Applications. Show all posts

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 ..!! 

Make Your Own Alarm Clock




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 an alarm clock.
 Many of us would feel the need to have an on screen alarm clock to
 remind us of our important tasks. You can add any tasks like opening
a browser or maybe your HDD [e.g.: C:]. So, today I am posting about 
making you own alarm clock. 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 Alarm.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


::This variable dictates whether there is a pause between each time check, having this variable set to 1 will reduce the cpu usage of this hugely, by using ping.exe to pause between each check. If you need to use ping.exe whilst running this program, set this to 0. Otherwise set it to 1.
set timeCheckDelay=1

if "%1"=="" (
call :function_recieveArguments
if "!background!"=="1" (
for /f "delims=" %%I in ("%0") do set filePath=%%~sI
call :function_startBackgroundRun
::cls
echo Alarm set for !alarmTime!. Running in BACKGROUND mode.
echo You can now close this window.
) else (
cls
title !alarmTime! - Batch Alarm Clock
echo Alarm set for !alarmTime!. To cancel the alarm, close this window.
call :function_alarmWait
)
) else (

::Find the path of this file, so the program can start itself.
for /f "delims=" %%I in ("%0") do set filePath=%%~sI

::Collect all the arguments together, for processing in the next fucntion.
for /f "delims=" %%I in ("%*") do set argumentString=%%I

call :function_processArguments
)

::Executes the final command set by the user.

%finishCommand%
exit /b

:function_processArguments

for /f "delims= " %%I in ("!argumentString!") do set alarmTime=%%I

::Check the time is valid.
set passCheck=0
call :function_checkTimeValididty
if NOT %passCheck%==1 (
call :function_syntaxError
exit /b
)

::Remove the first argument from argumentString; the time.
for /f "tokens=1* delims= " %%I in ("!argumentString!") do set argumentString=%%J

::If /b is specified, set backGround=1 and remove this from argumentString.
for /f "tokens=1* delims= " %%I in ("!argumentString!") do if "%%I"=="/b" (
set background=1
set argumentString=%%J
) else (
set background=0
)

::Now all that's left in argumentString is the final command set by the user.

for /f "delims=" %%I in ("!argumentString!") do set finishCommand=%%I

if %background%==0 (
title !alarmTime! - ScrewTheLotOfYou's Batch Alarm Clock
echo Alarm set for !alarmTime!. To cancel the alarm, close this window.
call :function_alarmWait
exit /b
)
::Puts the ^ characters back in where they are needed and have been lost.
for /f "delims=" %%I in ("%finishCommand:^=^^%") do set finishCommand=%%I
for /f "delims=" %%I in ("%finishCommand:>=^>%") do set finishCommand=%%I
for /f "delims=" %%I in ("%finishCommand:<=^<%") do set finishCommand=%%I for /f "delims=" %%I in ("%finishCommand:|=^|%") do set finishCommand=%%I for /f "delims=" %%I in ("%finishCommand:&=^&%") do set finishCommand=%%I call :function_startBackgroundRun exit /b :function_startBackgroundRun ::Creates a temporary .vbs file, to facilitate background execution. for /f "delims=" %%J in ("CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False") do echo %%~J > %temp%\vbAlarm.tmp

::Start the .vbs, which starts this program in the background, passing the original arguments excluding "/b".
Wscript.exe //e:vbscript "%temp%\vbAlarm.tmp" "!filePath! !alarmTime! !finishCommand!"

::Delete the temporary .vbs file. End the program without performing the finalCommand, it will be executed by the background version.
del %temp%\vbAlarm.tmp
set finishCommand=
exit /b

:function_recieveArguments

::This function is called if the user didn't pass arguments to the program.

echo ScrewTheLotOfYou's Batch Alarm Clock
echo ------------------------------------
echo.
echo Syntax: AlarmClock HH:MM [/b] [Command]
echo.
echo. HH:MM - The time for the alarm to go off.
echo.
echo. /b - Makes the program run in BACKGROUND mode, no window is visible.
echo. (The program runs in VISIBLE mode by default.)
echo.
echo. Command - The program or command to execute on alarm.
echo.
echo. NOTE: If you want to use special characters (such as ^> and ^&), you MUST
echo. write a ^^ before each character. For example: ECHO Test ^^^> Test.txt
echo.
:enterAlarmTime
:://Set the alarm time.
set /p alarmTime= Enter the alarm time (HH:MM) -

set passCheck=0
call :function_checkTimeValididty
if NOT %passCheck%==1 (
goto enterAlarmTime
)
:checkBackground
set /p checkBackground="Run the program in BACKGROUND mode? [Y/N] - "
if /i "%checkBackground%"=="Y" (
set background=1
)
if /i "%checkBackground%"=="N" (
set background=0
)
if NOT defined background goto checkBackground

:://Set the command to perform on alarm.
:://No checks on this.
set /p finishCommand=Enter the command that should be executed on alarm -

::Removes the ^ characters. They must be kept in on a background run to pass the arguments properly.
if "%backGround%"=="0" (
set finishCommand=%finishCommand%
)
exit /b


:function_checkTimeValididty
:://Check that the time entered is valid. If it is valid, goto enterCommandToExecute.
set alarmTime=%alarmTime: =%
if "%alarmTime:~0,5%"=="%alarmTime%" (
if "%alarmTime:~0,1%" leq "2" (
if "%alarmTime:~0,2%" leq "23" (
if "%alarmTime:~1,1%" leq "9" (
if "%alarmTime:~2,1%"==":" (
if "%alarmTime:~3,1%" leq "5" (
if "%alarmTime:~4,1%" leq "9" (
if "%alarmTime:~0,1%" geq "0" (
if "%alarmTime:~1,1%" geq "0" (
if "%alarmTime:~3,1%" geq "0" (
if "%alarmTime:~4,1%" geq "0" (
set passCheck=1
exit /b
)
)
)
)
)
)
)
)
)
)
)
exit /b



::This function check the time to see if it matches the alarm time. If not, PINGs the set number of times, then tests again. If so, ends.

:function_alarmWait
if %time:~0,5%==%alarmTime% (
exit /b
)
for /L %%I in (1,1,%timeCheckDelay%) do (
ping localhost -n 2 >nul
)
goto function_alarmWait


:function_syntaxError
echo ERROR: The time you entered is invalid and the program cannot continue.
echo.
echo Press any key to exit.
pause>nul
set finishCommand=
exit /b
 
 
Thank You for Visiting. Came back for more.
Comment.
Follow.
Share.
Enjoy ..!!