Page 1 of 1

IF statement when the timer reaches a certain time do this..

Posted: 02 Feb 2015 13:19
by gbattis
I need help writing this bit of code on this timer. I need it to open another file after a certain time is reached such as 0:01:03 (aka 1m 3s after it is started) all while going back and looping without it stopping. This is going to be repetitive and different times after (1:03 2:04 3:23...).

Code: Select all

@echo off
pause
set h=00& set m=00& set s=00
:loop
if "%s%"=="60" (
   set /a m=%m% +1
   set s=0
)

if "%m%"=="60" (
   set /a h=%h% +1
   set m=0
)
cls
echo.
echo Timer: %h%:%m%:%s%
echo.
timeout /t 1 >nul
set /a s=%s% +1
goto loop

Re: IF statement when the timer reaches a certan time do thi

Posted: 02 Feb 2015 16:39
by foxidrive
This will not keep accurate time - is that what you want to do?

Re: IF statement when the timer reaches a certan time do thi

Posted: 02 Feb 2015 16:42
by foxidrive
These 4 batch files use time collection and display:

Code: Select all

@echo off & setlocal enabledelayedexpansion & mode con cols=27 lines=6 & color 0a
set "cc=█ "
for %%a in (4 1 2 1 2 1 4 2 1 2 1 2 1 2 1 2 4 2 5 2 6 2 4 2 5 1 2
1 4 2 1 2 5 2 3 2 8 2 4 1 7 2 1 2 1 2 1 2 5 1 5 1 8 1 4 2 4) do (
  set "cc=!cc:~-1!!cc:~0,1!"
  for /l %%i in (1,1,%%a) do set "dgts=!dgts!!cc:~-1!"
)
for /l %%z in () do (
  if "!time:~7,1!" neq "!sec!" (
    set "sec=!time:~7,1!" & set "oc="
    for /l %%h in (0,1,4) do (
      for %%d in (0 sp 1 sp : sp 3 sp 4 sp : sp 6 sp 7) do (
        if "%%d"==":" (set /a "tt=%%h&1"&if "!tt!"=="0" (set oc=!oc! ) else set oc=!oc!*) else (
          if "%%d"=="sp" (set oc=!oc! ) else (
            set "timeP=!time: =0!"&set /a s=!timeP:~%%d,1!*15+%%h*3
            for %%o in (!s!) do set "oc=!oc!!dgts:~%%o,3!"
))))&cls & set /p=!oc!<nul))



Code: Select all

@echo off
if "%~1" equ "alarmOff" goto alarmOff
setlocal DisableDelayedExpansion
set "bang=!"
setlocal EnableDelayedExpansion

::batch clock
::code author: carlos
::skin author: mxpower
::the clock automatically updates the display
::rem many changes
::rem updated 2013 october
::rem created 2008 november

rem Modified by Antonio Perez Ayala @ Oct/2013: display layouts, alarm/timer and calendar added
rem Nov/02/2013 - Version 1.0
if "%~1" neq "/?" goto begin
echo Clock.bat [/D] [/12] [/C] [/S:#] [/B:#] [/T:m[:s]] [/A:hh:mm]
echo/
echo    /D        Set blinking dots
echo    /12       Set 12 hour format
echo    /C        Show calendar
echo    /S:#      Set small size, from 0 to 2 (cancel /Calendar)
echo    /B:#      Set brightness, from 0 to 3
echo    /T:m[:s]  Set timer in minutes and optional seconds
echo    /A:hh:mm  Set alarm time in 24 hour format (minutes in two digits)
echo/
echo You may run several instances of this program to set several timers or alarms
echo at different times; however, if more than one timer/alarm sounds at same time,
echo this program may fail.
echo/
echo To stop the buzzing alarm, press Enter.
goto :EOF

:begin
set "blink="
if /I "%~1" equ "/D" set "blink_dot=1" & set "blink=1" & shift
set "ampm1= "
set "ampm2= "
if /I "%~1" equ "/12" set "ampm2=M" & shift
if /I "%~1" equ "/C" set "cal=1" & shift
set cols=52
set lines1=21
set lines2=23
set stdFont=large
set "size="
set "param=%~1"
if /I "!param:~0,3!" equ "/S:" (
   set "size=!param:~3!"
   if "!size!" equ "0" (
      set cols=15
      set lines1=4
      set lines2=4
      set stdFont=thin
   ) else if "!size!" equ "1" (
      set cols=21
      set lines1=9
      set lines2=9
   ) else (
      set cols=29
   )
   set "cal="
   shift
)
set lines=%lines1%
set level=3
set "param=%~1"
if /I "!param:~0,3!" equ "/B:" set "level=!param:~3!" & shift
set "bright=.░▒▓█"
set back=!bright:~%level%,1!
set /A level+=1
set clock=!bright:~%level%,1!
for /L %%i in (1,1,48) do set "back=!back!%back%"
set "frame=═"
for /L %%i in (1,1,48) do set "frame=!frame!%frame%"
if not defined cal (
   set "fr=└─┘"
   set w1=13
   set w2=12
) else (
   set "fr=└─┴"
   set w1=1
   set w2=24
)
set "space= "
for /L %%i in (1,1,30) do set "space=!space!%space%"
set "timer="
set "alarm="
set "alarmORtimer="
set "param=%~1"
if /I "!param:~0,3!" equ "/T:" (
   for /F "tokens=1,2 delims=:" %%a in ("!param:~3!") do set /A "timerM=100+%%a, timerS=100+100%%b %% 100"
   set "timer=!bang!timerM:~-2!bang!:!bang!timerS:~-2!bang!"
   set blink_tmr=1
   set blink=1
   set alarmOrTimer=1
   set "alarm=     "
   shift
)
set "param=%~1"
if /I "!param:~0,3!" equ "/A:" (
   set "alarm=!param:~3!"
   if "!alarm:~1,1!" equ ":" set "alarm=0!alarm!"
   if not defined timer set "timer=     "
   set alarmOrTimer=1
)
if defined alarmORtimer (
   if not defined cal (
      set "fr=├┬┤%fr%"
   ) else (
      set "fr=├┬┼%fr%"
   )
   set lines=%lines2%
)

if %stdFont% equ large (
   Set "stdFont1=@@@ @ @@@@@@@ @@@@@@@@@@@@@@@@   "
   Set "stdFont2=@ @ @   @  @@ @@  @    @@ @@ @   "
   Set "stdFont3=@ @ @ @@@@@@@@@@@@@@@  @@@@@@@   "
   Set "stdFont4=@ @ @ @    @  @  @@ @  @@ @  @   "
   Set "stdFont5=@@@ @ @@@@@@  @@@@@@@  @@@@@@@   "
   for /L %%i in (1,1,5) do set "stdFont%%i=!stdFont%%i:@=%clock%!"
) else (
   Set "stdFont1=┌─┐ │  ─┐ ─┐│ │┌─ ┌─  ─┐┌─┐┌─┐   "
   Set "stdFont2=│ │ │ ┌─┘ ─┤└─┤└─┐├─┐  │├─┤└─┤   "
   Set "stdFont3=└─┘ │ └─  ─┘  │ ─┘└─┘  │└─┘ ─┘   "
   set "clock=°"
)
Set "small1= _     _  _     _  _  _  _  _ "
Set "small2=│ │ │  _│ _││_││_ │_   ││_││_│"
Set "small3=│_│ │ │_  _│  │ _││_│  ││_│ _│"
set "m=JanFebMarAprMayJunJulAugSepOctNovDec"
set "w=SunMonTueWedThuFriSat"
set /A "sun=0,mon=1,tue=2,wed=3,thu=4,fri=5,sat=6"
set /A "jan=1,feb=2,mar=3,apr=4,may=5,jun=6,jul=7,aug=8,sep=9,oct=10,nov=11,dec=12"
set lastDay=0
call :getDate
mode con cols=%cols% lines=%lines%
color 0A

:clock
call :getDate
set hourB=%hour%
if "%ampm2%" equ "M" (
   set "ampm1=A"
   if %hour% geq 12 set /A hour-=12 & set "ampm1=P"
   if "!hour!" equ "0" set hour=12
)

set /A h1=10%hour%/10%%10,h2=hour%%10, m1=10%minute%/10%%10,m2=minute%%10, d1=10%day%/10%%10,d2=day%%10
if "%ampm2%" equ "M" if %h1% equ 0 set h1=10
set "font=stdFont"
for %%_ in (h1 h2 m1 m2 d1 d2) do (
   if %%_ equ d1 set "font=small"
   set /a "index=3*%%_"
   for %%s in (!font!) do for %%# in (!index!) do for /L %%i in (1,1,5) do set "%%_%%i=!%%s%%i:~%%#,3!"
)

set /a "index=3*(month-1)"
Set mfp=!m:~%index%,3!
set /a "index=3*weekday"
Set wdp=!w:~%index%,3!

set "th1=%day%%month%%year%%hourB%%minute%"
if %hourB% lss 10 set hourB=0%hourB%
if "%alarm%" neq "     " if "%alarm%" equ "%hourB%:%m1%%m2%" (
   call :showClock "%clock%"
   call :alarm
   set "alarm=     "
   if "%timer%" equ "     " (
      set "alarmOrTimer="
      set lines=%lines1%
      mode con cols=%cols% lines=!lines!
      set "fr=%fr:~3%"
   )
   call :showClock "%clock%"
)

:blink
if "%timer%" neq "     " set /A timerS-=1 & if "!timerS!" equ "99" set /A timerM-=1, timerS=159
call :showClock "%clock%"
if "%timer%" neq "     " if "%timerM%:%timerS%" equ "100:100" (
   call :alarm
   set "timer=     "
   set "blink_tmr="
   if not defined blink_dot set "blink="
   if "%alarm%" equ "     " (
      set "alarmOrTimer="
      set lines=%lines1%
      mode con cols=%cols% lines=!lines!
      set "fr=%fr:~3%"
   )
   call :showClock "%clock%"
)
   :upd
   ping -n 2 localhost >nul
   if "%timer%" neq "     " set /A timerS-=1 & if "!timerS!" equ "99" set /A timerM-=1, timerS=159
   if defined blink_dot (call :showClock " ") else if defined blink_tmr call :showClock "%clock%"
   if "%timer%" neq "     " if "%timerM%:%timerS%" equ "100:100" (
      call :alarm
      set "timer=     "
      set "blink_tmr="
      if not defined blink_dot set "blink="
      if "%alarm%" equ "     " (
         set "alarmOrTimer="
         set lines=%lines1%
         mode con cols=%cols% lines=!lines!
         set "fr=%fr:~3%"
      )
      call :showClock "%clock%"
   )
   ping -n 2 localhost >nul
   call :getDate
   set "th2=%day%%month%%year%%hour%%minute%"
if "%th1%" equ "%th2%" (
   if not defined blink (
      goto upd ) else (
   goto blink  ) ) else (
goto clock
)


:showClock dot

cls
if defined size goto smallSize
title %mfp%/%day% @ %hourB%:%m1%%m2%
echo/
echo  ╔%frame:~0,48%╗
if not defined cal (
   echo  ║%back:~0,20% MxPower %back:~0,19%║
   echo  ║%back:~0,13%┌─────────────────────┐%back:~0,12%║
   echo  ║%back:~0,13%│                     │%back:~0,12%║
   echo  ║%back:~0,13%│ %h11% %h21%   %m11% %m21%   │%back:~0,12%║
   echo  ║%back:~0,13%│ %h12% %h22% %~1 %m12% %m22% %ampm1% │%back:~0,12%║
   echo  ║%back:~0,13%│ %h13% %h23%   %m13% %m23%   │%back:~0,12%║
   echo  ║%back:~0,13%│ %h14% %h24% %~1 %m14% %m24% %ampm2% │%back:~0,12%║
   echo  ║%back:~0,13%│ %h15% %h25%   %m15% %m25%   │%back:~0,12%║
   echo  ║%back:~0,13%│                     │%back:~0,12%║
   echo  ║%back:~0,13%%fr:~0,1%──────────%fr:~1,1%──────────%fr:~2,1%%back:~0,12%║
) else (
   echo  ║%back:~0,8% MxPower %back:~0,12% %mfp% - %year% %back:~0,7%║
   echo  ║%back:~0,1%┌─────────────────────┬──────────────────────┐%back:~0,1%║
   echo  ║%back:~0,1%│                     │ Su Mo Tu We Th Fr Sa │%back:~0,1%║
   echo  ║%back:~0,1%│ %h11% %h21%   %m11% %m21%   │%cal:~0,21% │%back:~0,1%║
   echo  ║%back:~0,1%│ %h12% %h22% %~1 %m12% %m22% %ampm1% │%cal:~21,21% │%back:~0,1%║
   echo  ║%back:~0,1%│ %h13% %h23%   %m13% %m23%   │%cal:~42,21% │%back:~0,1%║
   echo  ║%back:~0,1%│ %h14% %h24% %~1 %m14% %m24% %ampm2% │%cal:~63,21% │%back:~0,1%║
   echo  ║%back:~0,1%│ %h15% %h25%   %m15% %m25%   │%cal:~84,21% │%back:~0,1%║
   echo  ║%back:~0,1%│                     │%cal:~105,21% │%back:~0,1%║
   echo  ║%back:~0,1%%fr:~0,1%──────────%fr:~1,1%──────────%fr:~2,1%──────────────────────┘%back:~0,1%║
)
if defined alarmORtimer (
   echo  ║!back:~0,%w1%!│ Tr %timer% │ Al %alarm% │!back:~0,%w2%!║
   echo  ║!back:~0,%w1%!└──────────┴──────────┘!back:~0,%w2%!║
)
echo  ║%back:~0,48%║
echo  ║%back:~0,5%┌───┐%back:~0,3%┌───┐%back:~0,1%  %d11%%d21%  %back:~0,1%┌────┐%back:~0,12%║
echo  ║%back:~0,5%│%wdp%│%back:~0,3%│%mfp%│%back:~0,1%  %d12%%d22%  %back:~0,1%│%year%│%back:~0,12%║
echo  ║%back:~0,5%└───┘%back:~0,3%└───┘%back:~0,1%  %d13%%d23%  %back:~0,1%└────┘%back:~0,12%║
echo  ║%back:~0,19%          %back:~0,19%║
echo  ║%back:~0,48%║
echo  ╚══╦═════╦%frame:~0,30%╦═════╦══╝
echo     ╚═════╝%space:~0,30%╚═════╝
exit /B

:smallSize
title %hourB%:%m1%%m2%
if %size% equ 0 (
   echo %h11%%h21% %m11%%m21%%ampm1%
   echo %h12%%h22%%~1%m12%%m22%
   echo %h13%%h23%%~1%m13%%m23%%ampm2%
   if not defined alarmOrTimer (
      set /P "=-%mfp% %d1%%d2% %year%-" < NUL
   ) else (
      set /P "=T%timer% A%alarm%" < NUL
   )
) else if %size% equ 1 (
   echo/
   echo  %h11% %h21%   %m11% %m21%
   echo  %h12% %h22% %~1 %m12% %m22% %ampm1%
   echo  %h13% %h23%   %m13% %m23%
   echo  %h14% %h24% %~1 %m14% %m24% %ampm2%
   echo  %h15% %h25%   %m15% %m25%
   set /P "=───────────────────── %wdp%, %mfp%  %d1%%d2%  %year%   " < NUL
   if defined alarmOrTimer set /P "=Tr %timer%  Al %alarm%" < NUL
) else (
   echo/
   echo  ╔!frame:~0,25!╗
   echo  ║%back:~0,8% MxPower %back:~0,8%║
   echo  ║!back:~0,1!┌─────────────────────┐!back:~0,1!║
   echo  ║!back:~0,1!│                     │!back:~0,1!║
   echo  ║!back:~0,1!│ %h11% %h21%   %m11% %m21%   │!back:~0,1!║
   echo  ║!back:~0,1!│ %h12% %h22% %~1 %m12% %m22% %ampm1% │!back:~0,1!║
   echo  ║!back:~0,1!│ %h13% %h23%   %m13% %m23%   │!back:~0,1!║
   echo  ║!back:~0,1!│ %h14% %h24% %~1 %m14% %m24% %ampm2% │!back:~0,1!║
   echo  ║!back:~0,1!│ %h15% %h25%   %m15% %m25%   │!back:~0,1!║
   echo  ║!back:~0,1!│                     │!back:~0,1!║
   echo  ║!back:~0,1!%fr:~0,1%──────────%fr:~1,1%──────────%fr:~2,1%!back:~0,1!║
   if defined alarmORtimer (
      echo  ║!back:~0,1!│ Tr %timer% │ Al %alarm% │!back:~0,1!║
      echo  ║!back:~0,1!└──────────┴──────────┘!back:~0,1!║
   )
   echo  ║!back:~0,25!║
   echo  ║!back:~0,1!┌───┐%back:~0,1%  %d11%%d21%  %back:~0,1%┌────┐!back:~0,1!║
   echo  ║!back:~0,1!│%mfp%│%back:~0,1%  %d12%%d22%  %back:~0,1%│%year%│!back:~0,1!║
   echo  ║!back:~0,1!└───┘%back:~0,1%  %d13%%d23%  %back:~0,1%└────┘!back:~0,1!║
   echo  ║!back:~0,7!          !back:~0,8!║
   echo  ║!back:~0,25!║
   echo  ╚══╦═════╦!frame:~0,7!╦═════╦══╝
   echo     ╚═════╝!space:~0,7!╚═════╝
)
exit /B


:getDate
set "tf=~%random%"
type nul > "%temp%\%tf%.ddf"
makecab /d rptfilename="%temp%\%tf%.rpt" /d inffilename=nul /f "%temp%\%tf%.ddf" > nul
for /f "usebackq tokens=3-9 delims=: " %%a in ("%temp%\%tf%.rpt") do (
   set /A "year=%%g,month=%%b,day=1%%c-100,weekday=%%a"
   set /A "hour=1%%d-100,minute=1%%e-100,second=1%%f-100"
   goto continue
)
:continue
del "%temp%\%tf%.ddf" "%temp%\%tf%.rpt" 2>nul

if not defined cal exit /B
if %day% equ %lastDay% exit /B

set /A "leap=year%%4, index=(month-1)*2, dow=weekday-day%%7+1"
if %dow% lss 0 set /A dow+=7
if %leap% neq 0 (
   set "dpm=3128"
) else (
   set "dpm=3129"
)
set "dpm=%dpm%31303130313130313031"
set dpm=!dpm:~%index%,2!
set "cal="
for /L %%i in (1,1,%dow%) do set "cal=!cal!   "
for /L %%i in (1,1,%dpm%) do (
   if %%i neq %day% (
      set "n=  %%i"
      set "cal=!cal!!n:~-3!"
   ) else (
      set "cal=!cal! ██"
   )
)
for /L %%i in (1,1,15) do set "cal=!cal!   "
set lastDay=%day%
exit /B


:alarm
del "%temp%\alarmOff.flg" 2> NUL
start "" /B "%~F0" alarmOff
:alarmOn
   color CE
   set /P "=" < NUL
   ping -n 2 localhost >nul
   color A
   set /P "=" < NUL
   ping -n 2 localhost >nul
if not exist "%temp%\alarmOff.flg" goto alarmOn
del "%temp%\alarmOff.flg"
exit /B

:alarmOff
set /P "="
echo off > "%temp%\alarmOff.flg"
exit


Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion

::batch clock
::code author: carlos
::skin author: mxpower
::last updated: 2013, 18 november: reduced cpu usage fixed
::created: 2008, october
::the clock automatically updates the display
::note: only open 1 instance of this script else it may fail
::for not show the week day change the variable show_week_day to 0
set /a "show_week_day=1"
::

mode con cols=49 lines=16
color 0a

Set "diga= _     _  _     _  _  _  _  _ "
Set "digb=│ │ │  _│ _││_││_ │_   ││_││_│"
Set "digc=│_│ │ │_  _│  │ _││_│  ││_│ _│"
set "m= January   February   March     April      May       June   "
set "m=%m%   July     August  September  October   November  December "
set "w=MonTueWedThuFriSatSun"

call :getdate.init
call :getdate

:clock

set /a "h1=hour/10,h2=hour-10*h1"
set /a "m1=minute/10,m2=minute-10*m1"

for %%_ in (h1 h2 m1 m2) do (set /a "index=3*%%_"
for %%# in (!index!) do (
set "%%_a=!diga:~%%#,3!"
set "%%_b=!digb:~%%#,3!"
set "%%_c=!digc:~%%#,3!"
))

set /a "index=10*(month-1)"
set "mfp=!m:~%index%,10!"
set /a "index=3*(weekday-1)"
set "wdp=!w:~%index%,3!"
set "dfp=%day%"
if %dfp% lss 10 set "dfp=0%dfp%"

title %h1%%h2%:%m1%%m2%
cls
echo.
echo  ╔═════════════════════════════════════════════╗
echo  ║▓▓▓▓▓▓▓▓▓▓▒┌────────────────────┐▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓MxPower▓▓▒│ %h1a% %h2a%   %m1a% %m2a%  │▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓▓▓▒│ %h1b% %h2b% . %m1b% %m2b%  │▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓▓▓▒│ %h1c% %h2c% . %m1c% %m2c%  │▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓▓▓▒│                    │▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓▓▓▒└────────────────────┘▒▓▓▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▒║
if 1 equ %show_week_day% (
echo  ║▓▓▓▓▓░┌───┐▒░┌──┐▒░┌──────────┐▒░┌────┐▒▓▓▓▓▒║
echo  ║▓▓▓▓▓░│%wdp%│▒░│%dfp%│▒░│%mfp%│▒░│%year%│▒▓▓▓▓▒║
echo  ║▓▓▓▓▓░└───┘▒░└──┘▒░└──────────┘▒░└────┘▒▓▓▓▓▒║
) else (
echo  ║▓▓▓▓▓▓▓▓░┌──┐▒░┌──────────┐▒░┌────┐▒▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓░│%dfp%│▒░│%mfp%│▒░│%year%│▒▓▓▓▓▓▓▓▓▒║
echo  ║▓▓▓▓▓▓▓▓░└──┘▒░└──────────┘▒░└────┘▒▓▓▓▓▓▓▓▓▒║
)
echo  ║▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒║
echo  ╚═════════════════════════════════════════════╝
echo     └─────┘                           └─────┘


set "th1=%day%%month%%year%%hour%%minute%"
:upd
call :getdate
set "th2=%day%%month%%year%%hour%%minute%"
if not "%th1%"=="%th2%" goto :clock
ping -l 0 -n 1 -w 500 1.0.0.0 >nul
goto :upd

:getdate.init
set /a "jan=1,feb=2,mar=3,apr=4,may=5,jun=6,jul=7,aug=8,sep=9,oct=10,nov=11,dec=12"
set /a "mon=1,tue=2,wed=3,thu=4,fri=5,sat=6,sun=7"
(echo .set infheader=""
echo .set infsectionorder=""
echo .set inffooter="%%2"
for /l %%# in (1,1,4) do echo .set inffooter%%#=""
echo .set cabinet="off"
echo .set compress="off"
echo .set donotcopyfiles="on"
echo .set rptfilename="nul"
) >"%temp%\~foo.ddf"
goto :eof

:getdate
set "tf=%temp%\~%random%"
makecab /d inffilename="%tf%" /f "%temp%\~foo.ddf" >nul
for /f "usebackq tokens=1-7 delims=: " %%a in ("%tf%") do (
set /a "year=%%g,month=%%b,day=1%%c-100,weekday=%%a"
set /a "hour=1%%d-100,minute=1%%e-100,second=1%%f-100")
del "%tf%" >nul 2>&1
goto :eof


Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion

::batch clock tiny
::code author: carlos
::last updated: 2013, 18 november: reduced cpu usage fixed
::created: 2013, october
::
::the clock automatically updates the display
::note: only open 1 instance of this script else it may fail
::for use 24 hour clock set /a "format=24"
::for use 12 hour clock set /a "format=12"
set /a "format=12"
::
mode con cols=23 lines=10
color 0a

Set "diga=███ █ ███████ ████████████████"
Set "digb=█ █ █   █  ██ ██  █    ██ ██ █"
Set "digc=█ █ █ ███████████████  ███████"
Set "digd=█ █ █ █    █  █  ██ █  ██ █  █"
Set "dige=███ █ ██████  ███████  ███████"
set "m=JanFebMarAprMayJunJulAugSepOctNovDec"
set "w=MonTueWedThuFriSatSun"

call :getdate.init
call :getdate

:clock
set "th1=%day%%month%%year%%hour%%minute%"
set "da=."
set "db=."
if 12 equ !format! (set "db=M"
set "da=A"
if 12 leq %hour% (set /a "hour-=12"
set "da=P"
)
if 0 equ !hour! set "hour=12"
)

set /a "h1=hour/10,h2=hour-10*h1"
set /a "m1=minute/10,m2=minute-10*m1"

for %%_ in (h1 h2 m1 m2) do (set /a "index=3*%%_"
for %%# in (!index!) do (
set "%%_a=!diga:~%%#,3!"
set "%%_b=!digb:~%%#,3!"
set "%%_c=!digc:~%%#,3!"
set "%%_d=!digd:~%%#,3!"
set "%%_e=!dige:~%%#,3!"
))

set /a "index=3*(month-1)"
Set "mfp=!m:~%index%,3!"
set /a "index=3*(weekday-1)"
Set "wdp=!w:~%index%,3!"
set "dfp=%day%"
if %dfp% lss 10 set "dfp= %dfp%"

cls
if 12 equ !format! (title %h1%%h2%:%m1%%m2% %da%%db%
) else title %h1%%h2%:%m1%%m2%
echo(
echo    %h1a% %h2a%   %m1a% %m2a%
echo    %h1b% %h2b%   %m1b% %m2b%
echo    %h1c% %h2c% %da% %m1c% %m2c%
echo    %h1d% %h2d% %db% %m1d% %m2d%
echo    %h1e% %h2e%   %m1e% %m2e%
echo(
echo    ───────┬──┬──────
echo      %wdp%  │%dfp%│ %mfp%

:upd
call :getdate
set "th2=%day%%month%%year%%hour%%minute%"
if not "%th1%"=="%th2%" goto :clock
ping -l 0 -n 1 -w 500 1.0.0.0 >nul
goto :upd

:getdate.init
set /a "jan=1,feb=2,mar=3,apr=4,may=5,jun=6,jul=7,aug=8,sep=9,oct=10,nov=11,dec=12"
set /a "mon=1,tue=2,wed=3,thu=4,fri=5,sat=6,sun=7"
(echo .set infheader=""
echo .set infsectionorder=""
echo .set inffooter="%%2"
for /l %%# in (1,1,4) do echo .set inffooter%%#=""
echo .set cabinet="off"
echo .set compress="off"
echo .set donotcopyfiles="on"
echo .set rptfilename="nul"
) >"%temp%\~foo.ddf"
goto :eof

:getdate
set "tf=%temp%\~%random%"
makecab /d inffilename="%tf%" /f "%temp%\~foo.ddf" >nul
for /f "usebackq tokens=1-7 delims=: " %%a in ("%tf%") do (
set /a "year=%%g,month=%%b,day=1%%c-100,weekday=%%a"
set /a "hour=1%%d-100,minute=1%%e-100,second=1%%f-100")
del "%tf%" >nul 2>&1
goto :eof

Re: IF statement when the timer reaches a certain time do th

Posted: 02 Feb 2015 17:38
by Ed Dyreen

Code: Select all

@echo off &setlocal enableDelayedExpansion &mode con cols=27 lines=6 &color 0A
set "cc=¦ "
for %%? in (

       4,1,2,1,2,1,4,2,1,2,1,2,1,2,1,2,4,2,5,2,6,2,4,2,5,1,2,1,4,2,1,2,5,2,3,2,8,2,4,1,7,2,1,2,1,2,1,2,5,1,5,1,8,1,4,2,4

) do   set "cc=!cc:~-1!!cc:~0,1!" &for /L %%? in (

       1, 1, %%?

) do   set "dgts=!dgts!!cc:~-1!"
::
for /L %%? in () do if "!time:~7,1!" neq "!sec!" (

       set "sec=!time:~7,1!"
       set  "oc="
       for /L %%h in (

              0, 1, 4

       ) do   for %%d in (

              0 sp 1 sp : sp 3 sp 4 sp : sp 6 sp 7

       ) do   if "%%d"==":" (

              set /A "tt=%%h&1"&if "!tt!"=="0" (

                     set "oc=!oc! "
              ) else set "oc=!oc!*"

       ) else if "%%d"=="sp" (

              set "oc=!oc! "

       ) else (
              set "timeP=!time: =0!"
              set /A s=!timeP:~%%d,1!*15+%%h*3
              for %%? in (

                     !s!

              ) do   set "oc=!oc!!dgts:~%%?,3!"
       )
       cls
       set /p=!oc!<nul
)
I understand oc stands for octals, dgts for digits, do u happen to remember how this raster matrix is organized, the numbers, 4,1,2 if I change it to 4,3,2 the screen is scrambled. How should I interpret these numbers ?

Code: Select all

4,1,2,1,2,1,4,2,1,2,1,2,1,2,1,2,4,2,5,2,6,2,4,2,5,1,2,1,4,2,1,2,5,2,3,2,8,2,4,1,7,2,1,2,1,2,1,2,5,1,5,1,8,1,4,2,4

Re: IF statement when the timer reaches a certain time do th

Posted: 13 Feb 2015 16:37
by gbattis
Sorry for a late reply. The timer needs to play a sound file once the time has got to 1m 4s, 2m 10s, 3m 16s, 4m 22s and so on... I will have about 30 times and it would also be a huge help if the color can change from green to red 10 seconds before the elapsed time is reached. Then after the time has reached go back to green.

Re: IF statement when the timer reaches a certain time do th

Posted: 19 Feb 2015 12:03
by gbattis
bump. any luck?