Can this Binary Clock display in the window

November 12, 2010 at 11:20:50
Specs: Windows XP
can this Binary Clock display in the window
I can get it to display on the window frame , but not inside the open window

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mode con: cols=80 lines=3
@echo Batch File Binary Clock by Eddie Duncan-Dunlop 2010 (c)

:start
@echo off
:::::::: get time ::::::::::::::::::

@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set _hr=%%A
Set _min=%%B
Set _Sec=%%C
)

:::::::::::: convert Time to binary 8 bits each ::::::::::::::::::
set binary=
set decimal=%_hr%
for /L %%n in (7,-1,0) do call :loop %%n

set decimal=%_min%
for /L %%n in (7,-1,0) do call :loop %%n

set decimal=%_sec%
for /L %%n in (7,-1,0) do call :loop %%n

::::::::::::::: display at top of window ::::::::::::::::::::::::::::::::::
title %_hr%:%_min%:%_sec% = %binary%

::::::::::::::: Read again till seconds change ::::::::::::::::::::::::
:read
@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set _h2r=%%A
Set _min2=%%B
Set _Sec2=%%C
)

if NOT %_sec2%==%_sec% goto start
if %_sec2%==%_sec% goto read

:::::::::Subroutine called Loop Starts here:::::::
:loop

:::: store number entered ::::
set store=%decimal%

::: remove leading zero if under 10::::::::::::
if %decimal% lss 10 set decimal=%store:0=%

:: make loop number=1,2,4,8,16,32,64 ...
set /a power="1<<%1"

:: subtract power number from decimal
set /a decimal-=%power%

if %decimal% GEQ 0 set binary=%binary%1

if NOT %decimal% GEQ 0 (
set binary=%binary%0
set decimal=%store%
)

:::::: add a gap every 4 bits (nibble) for clarity ::::::::
set gap=%1
set /a gap="gap%%4"
if "%gap%"=="0" set binary=%binary%
goto :eof
::::::::::::::: end of loop ::::::::::::::::::


See More: Can this Binary Clock display in the window

Report •


#1
November 12, 2010 at 13:03:27
mode con: cols=80 lines=3
@echo Batch File Binary Clock by Eddie Duncan-Dunlop 2010 (c)

:start
@echo off
:::::::: get time ::::::::::::::::::

@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set _hr=%%A
Set _min=%%B
Set _Sec=%%C
)

:::::::::::: convert Time to binary 8 bits each ::::::::::::::::::
set binary=
set decimal=%_hr%
for /L %%n in (7,-1,0) do call :loop %%n

set decimal=%_min%
for /L %%n in (7,-1,0) do call :loop %%n

set decimal=%_sec%
for /L %%n in (7,-1,0) do call :loop %%n

::::::::::::::: display at top of window ::::::::::::::::::::::::::::::::::
cls
echo %_hr%:%_min%:%_sec% = %binary%

::::::::::::::: Read again till seconds change ::::::::::::::::::::::::
:read
@For /F "tokens=1,2,3 delims=:,. " %%A in ('echo %time%') do @(
Set _h2r=%%A
Set _min2=%%B
Set _Sec2=%%C
)

if NOT %_sec2%==%_sec% goto start
if %_sec2%==%_sec% goto read

:::::::::Subroutine called Loop Starts here:::::::
:loop

:::: store number entered ::::
set store=%decimal%

::: remove leading zero if under 10::::::::::::
if %decimal% lss 10 set decimal=%store:0=%

:: make loop number=1,2,4,8,16,32,64 ...
set /a power="1<<%1"

:: subtract power number from decimal
set /a decimal-=%power%

if %decimal% GEQ 0 set binary=%binary%1

if NOT %decimal% GEQ 0 (
set binary=%binary%0
set decimal=%store%
)

:::::: add a gap every 4 bits (nibble) for clarity ::::::::
set gap=%1
set /a gap="gap%%4"
if "%gap%"=="0" set binary=%binary%
goto :eof

Can I put a question here?


Report •
Related Solutions


Ask Question