Batch Clock Display 06-03-2013, 05:37 AM
#1
Ahh, I got the idea from another user on another forum. My script is a lot less bogged up though and much shorter.
My #'s display:
![[Image: O3casMl.png]](http://i.imgur.com/O3casMl.png)
Just imagine a width of 5 "LED's", and a padding of 1 space in between each grid of 5x5 for each number. (Just to see the numbers easier when reading the script I added this padding.)
I'm also displaying a 12 hour clock with AM/PM.
Result:
![[Image: kfHfKzR.png]](http://i.imgur.com/kfHfKzR.png)
Script:
Notes:
1. There is a space at the end of this line:
2. Lines 20-24... There are 3 characters added to each. %line2% and %line4% get set to append {space}o{space}, and %line1%, %line3% and %line5% get set to append {space}{space}{space}
My #'s display:
![[Image: O3casMl.png]](http://i.imgur.com/O3casMl.png)
Just imagine a width of 5 "LED's", and a padding of 1 space in between each grid of 5x5 for each number. (Just to see the numbers easier when reading the script I added this padding.)
I'm also displaying a 12 hour clock with AM/PM.
Result:
![[Image: kfHfKzR.png]](http://i.imgur.com/kfHfKzR.png)
Script:
Code:
@echo off & setlocal enabledelayedexpansion
call :InitializeTimeDisplay
:timeloop
:: Set's: T, tH, tM, tS, Meridiem
call :SetTimeVariables
echo %th%:%tM%:%tS% %Meridiem%
call :ResetLines
for %%G in (%th% %tm% %tS%) do (
set part=%%G
for /l %%H in (0,1,1) do (
set /a i=!part:~%%H,1!
set /a i*=%disp_width%+%padding%
for /l %%I in (1,1,5) do (
call set line%%I=!line%%I!%%ln%%I:~!i!,%disp_width%%%
)
)
if not "%%G"=="%tS%" (
set line1=!line1!
set line2=!line2! o
set line3=!line3!
set line4=!line4! o
set line5=!line5!
)
)
for /l %%I in (1,1,5) do (
echo !line%%I!
)
timeout /T 1 > nul & cls & goto :timeloop
:: --------------------------- FUNCTIONS ---------------------------
:SetTimeVariables
set T=%time:~0,-3%
set tH=%T:~0,2%
if %tH% GTR 12 (
set Meridiem=PM
set /a tH-=12
) else (
set Meridiem=AM
)
set tM=%T:~3,2%
set tS=%T:~6,2%
goto :eof
:InitializeTimeDisplay
set disp_width=5
set padding=1
set ln1=##### ## ##### ##### # ## ##### ##### ##### ##### #####
set ln2=# ## ## ## ## # ## ## ## ## # ## # ##
set ln3=# ## ## ##### ##### ##### ##### ##### ## ##### #####
set ln4=# ## ## ## ## ## ## ## # ## # ## ##
set ln5=##### ## ##### ##### ## ##### ##### ## ##### #####
goto :eof
:ResetLines
set line1=
set line2=
set line3=
set line4=
set line5=
goto :eofNotes:
1. There is a space at the end of this line:
Code:
call set line%%I=!line%%I!%%ln%%I:~!i!,%disp_width%%%{Space}
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)
. I don't know "too" much about Linux, but enough to be dangerous. I've used Arch, Mint, BackTrack, and Ubuntu vaguely before...