Sinisterly
Batch Clock Display - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Batch Clock Display (/Thread-Batch-Clock-Display)



Batch Clock Display - ArkPhaze - 06-03-2013

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]

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]

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 :eof

Notes:
1. There is a space at the end of this line:
Code:
call set line%%I=!line%%I!%%ln%%I:~!i!,%disp_width%%%{Space}
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}


RE: Batch Clock Display - noize - 06-03-2013

I've just seen the post you said you got the idea from one or maybe two days ago.

I've got to say that there was a reason for that being that much long (consider special chars, if I remember correctly). I'll say that the front-end was a bit better than this one (also considering those same chars used), but surely this source is simpler and shorter. Very well organized code, I must say. As always. :hatDown:


RE: Batch Clock Display - Deque - 06-03-2013

That's a nice one. Too bad I don't use Windows much.


RE: Batch Clock Display - ArkPhaze - 06-04-2013

(06-03-2013, 03:02 PM)Deque Wrote: That's a nice one. Too bad I don't use Windows much.

Ahh, a Linux person? You have knowledge that I wish I had then Smile. I don't know "too" much about Linux, but enough to be dangerous. I've used Arch, Mint, BackTrack, and Ubuntu vaguely before...

(06-03-2013, 02:53 PM)noize Wrote: I've just seen the post you said you got the idea from one or maybe two days ago.

I've got to say that there was a reason for that being that much long (consider special chars, if I remember correctly). I'll say that the front-end was a bit better than this one (also considering those same chars used), but surely this source is simpler and shorter. Very well organized code, I must say. As always. :hatDown:

To be fair, I didn't even really look at the guy's code. I just seen that it looked like quite a bit of lines, so I wanted to see what I could come up with. This is all my own design. Smile


RE: Batch Clock Display - Deque - 06-04-2013

(06-04-2013, 12:29 AM)ArkPhaze Wrote:
(06-03-2013, 03:02 PM)Deque Wrote: That's a nice one. Too bad I don't use Windows much.
Ahh, a Linux person? You have knowledge that I wish I had then Smile. I don't know "too" much about Linux, but enough to be dangerous. I've used Arch, Mint, BackTrack, and Ubuntu vaguely before...

I still have Windows XP in a VM for malware analysis and Windows 7 as dual boot on my PC. But it's been a long time that I actually used it.
I use Arch and Ubuntu mainly.


RE: Batch Clock Display - noize - 06-04-2013

(06-04-2013, 12:29 AM)ArkPhaze Wrote: To be fair, I didn't even really look at the guy's code. I just seen that it looked like quite a bit of lines, so I wanted to see what I could come up with. This is all my own design. Smile

I know it's all your code, and I didn't take a deep breathe inside that guy's code either.

I've used too little Linux too. I'm planning on definitely switching to Linux.