| 1. |
Solve : count down? |
|
Answer» can you make a peice of code that will count down to a picific time yes.Some years ago, another poster requested the very same THING. I have a HTML Application script that does the counting down in a window. If you wanted it posted let us know. @echo off learn how to use loops man. All your codes could be 10x smaller if you want to count down to a specified time of day... Code: [Select] @echo off rem input time as hh:mm:ss rem use 24 hour clock rem e.g. for 4:15 PM use 16:15:00 rem only works for a time the same day rem does not check for nonsense time rem e.g. earlier than now set /p hhmmss=Start time hh:mm:ss? set hh=%hhmmss:~0,2% set mm=%hhmmss:~3,2% set ss=%hhmmss:~6,2% set stimefull=%hh%:%mm%:%ss% if "%hh:~0,1%"=="0" set hh=%hh:~1,1% if "%mm:~0,1%"=="0" set mm=%mm:~1,1% if "%ss:~0,1%"=="0" set ss=%ss:~1,1% set /a ssecs=%ss% set /a msecs=60*%mm% set /a hsecs=3600*%hh% set /a startsecs=%ssecs%+%msecs%+%hsecs% echo. echo Waiting for time %stimefull% :TWAIT set ntime=%time% set nhh=%time:~0,2% set nmm=%time:~3,2% set nss=%time:~6,2% if "%nhh:~0,1%"==" " set nhh=%nhh:~1,1% if "%nmm:~0,1%"=="0" set nmm=%nmm:~1,1% if "%nss:~0,1%"=="0" set nss=%nss:~1,1% set /a nssecs=%nss% set /a nmsecs=60*%nmm% set /a nhsecs=3600*%nhh% set /a ntimesecs=%nssecs%+%nmsecs%+%nhsecs% set /a timeleft=%startsecs%-%ntimesecs% title Seconds: %timeleft% if "%ntimesecs%" GEQ "%startsecs%" goto snow ping localhost -n 2 >nul goto twait :snow Quote from: devcom on January 09, 2009, 07:38:50 AM Quote from: BatchRocks on January 09, 2009, 05:05:52 AM@echo off I could say the very same to you about Classes in VB. |
|