[code] Batch Clock Widget
Moderator: DosItHelp
Re: [code] Batch Clock Widget
@Aacini: I did a last optimization to model 1.
Now I want use your small model 1. I have a idea.
Now I want use your small model 1. I have a idea.
Re: [code] Batch Clock Widget
DOS_Probie wrote:Good Job Aacini, Like how you have everything balanced and centered. How do you implement the 12 hr format?
The variables involved in the 12 hr format are "ampm1" and "ampm2"; for example:
Code: Select all
set "ampm1= "
set "ampm2= "
if /I "%~1" equ "/12" set "ampm2=M" & shift
if "%ampm2%" neq " " (
set "ampm1=A"
if %hour% geq 12 set /A hour-=12 & set "ampm1=P"
if "!hour!" equ "0" set hour=12
)
carlos wrote:@Aacini: good code.
I'm sure that we can optimize replacing if else for:Code: Select all
set /a "h1=hour/10,h2=hour-10*h1"
set /a "m1=minute/10,m2=minute-10*m1"
Or other arithmetic operation.
that is better than old:Code: Select all
if %hour% lss 10 (set /a "h1=0,h2=%hour%"
) else set /a "h1=%hour:~0,1%,h2=%hour:~1,1%"
if %minute% lss 10 (set /a "m1=0,m2=%minute%"
) else set /a "m1=%minute:~0,1%,m2=%minute:~1,1%"
Good idea! I just added such modification and also optimized another IF.
The "blinking dots" option has been added! See the updated code above...
Antonio
Re: [code] Batch Clock Widget
@Aacini: Very good fork. I will wait the timer and alarm.
Also, I posted a tiny model.
Also, I posted a tiny model.
-
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
Re: [code] Batch Clock Widget
carlos wrote:@Aacini: Very good fork. I will wait the timer and alarm.
Also, I posted a tiny model.
Carlos, Like what you did on the Mini Clock, Fits well with my sidebar gadgets, hey
is there any way to make the time font heavier and keep with same size? DP
Re: [code] Batch Clock Widget
@Dos_Probie: updated the code for use wide numbers.
Re: [code] Batch Clock Widget
Updated again, few seconds after post.
I look that in the title using 12 hour format is not showed the AM or PM.
Fixed it.
I look that in the title using 12 hour format is not showed the AM or PM.
Fixed it.
-
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
Re: [code] Batch Clock Widget
carlos wrote:@Dos_Probie: updated the code for use wide numbers.
Like the Bigger readout Carlos, good job (instead of the digital readout) and since you had a partial time in the title block I revised mine to show the current year of 2013. DP
Re: [code] Batch Clock Widget
@DosProbie: thanks.
and @Aacini: I found a little improvement for the getdate function, i will post.
and @Aacini: I found a little improvement for the getdate function, i will post.
Re: [code] Batch Clock Widget
Posted the updated codes with the improved getdate function.
Now it not show errors messages (generally for asynchronus access for the same function) and recover.
Also before it specify as inffilename=nul thats is ok except that makecab in that case create a file called like CAB00692.TMP or with similar name. Then if you close the cmd "application" makecab is closed and can left this file.
edit:
after other test I found that the CAB00692.TMP similar file is created always and deleted, but makecab works from the current directory that is the folder where is located our .cmd. Then if error ocurrs, this CAB00692.TMP left in this folder, for avoid it, I specify a /L %temp% as switch of makecab, for work with the files in the temp folder. In case of error, the files that left makecab are in temp folder.
Also I again specify inffilename=nul for avoid that makecab write a .inf file, that size is round 4 kb. With this: in a loop we not write to many times 4kb to disk that is unnecessary.
Now, the function is better.
Now it not show errors messages (generally for asynchronus access for the same function) and recover.
Also before it specify as inffilename=nul thats is ok except that makecab in that case create a file called like CAB00692.TMP or with similar name. Then if you close the cmd "application" makecab is closed and can left this file.
edit:
after other test I found that the CAB00692.TMP similar file is created always and deleted, but makecab works from the current directory that is the folder where is located our .cmd. Then if error ocurrs, this CAB00692.TMP left in this folder, for avoid it, I specify a /L %temp% as switch of makecab, for work with the files in the temp folder. In case of error, the files that left makecab are in temp folder.
Also I again specify inffilename=nul for avoid that makecab write a .inf file, that size is round 4 kb. With this: in a loop we not write to many times 4kb to disk that is unnecessary.
Now, the function is better.
Last edited by carlos on 29 Oct 2013 19:00, edited 1 time in total.
Re: [code] Batch Clock Widget
I posted my two version of clock with the last version of getdate function.
That have the next remark:
note: revisited.
@Aacini and @DosProbie: I hope the new revisited getdate function will be useful. I will like write a calendar but i not have more free time.
That have the next remark:
Code: Select all
::revisited improves to getdate function
note: revisited.
@Aacini and @DosProbie: I hope the new revisited getdate function will be useful. I will like write a calendar but i not have more free time.
Re: [code] Batch Clock Widget
The alarm and timer options in my program are working now! See the updated code above. This new version also features a calendar, although in a preliminary version (it requires some cosmetic details). NOTE: The two "set /P" commands in :alarm subroutine requires a Bell character (Ctrl-G) in order to buzzing when the alarm/timer ends. If the alarm does not sound, insert the Ctrl-G in the right place:
@carlos: Yes, I reviewed the revisited getdate function, but I have not time to include it in my code right now; I will include it in the next version. However, the /D blinking dots and /T: timer options in my program requires that getdate function be as fast as possible, so I must do some test before include the changes.
Antonio
Code: Select all
set /P "=" < NUL
^-- Insert a Ctrl-G character here
@carlos: Yes, I reviewed the revisited getdate function, but I have not time to include it in my code right now; I will include it in the next version. However, the /D blinking dots and /T: timer options in my program requires that getdate function be as fast as possible, so I must do some test before include the changes.
Antonio
Re: [code] Batch Clock Widget
I fix the code of tiny model for show the full title in windows 7.
@Aacini: I like the calendar. I like as default option the display with calendar. Is possible set a variable with the default configuration.
@Aacini: I like the calendar. I like as default option the display with calendar. Is possible set a variable with the default configuration.
Re: [code] Batch Clock Widget
An alternative for getDate that avoids creating a file, then deleting it.
Also weekday can be used directly
replace;
with; (or just put after above)
Code: Select all
:getDate
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set /a "year=%ldt:~0,4%,month=1%ldt:~4,2%-100,day=1%ldt:~6,2%-100,hour=1%ldt:~8,2%-100,minute=1%ldt:~10,2%-100"
set "second=%ldt:~12,6%"
for /f %%A in ("%DATE%") DO set weekday=%%A
exit /B
Also weekday can be used directly
replace;
Code: Select all
Set wdp=!w:~%index%,3!
with; (or just put after above)
Code: Select all
set wdp=%weekday%
Last edited by b8two on 31 Oct 2013 20:04, edited 1 time in total.
Re: [code] Batch Clock Widget
@b8two: thanks for share the routine using wmic. I avoid wmic because it not works in a limit account or account that not are in Administrators or Administradores (in spanish) group.
Re: [code] Batch Clock Widget
The new version of MxPower clock is complete now. It has the calendar fully functional and it also features two new small sizes. See the updated code above. Note that from my point of view this version is the first one, that is, is my first version with all its features fully implemented.
Antonio
Antonio