Programmatically change World Clock Settings

Discussion forum about Anuko World Clock

Programmatically change World Clock Settings

Postby rtdias » Thu Sep 01, 2016 5:52 am

Hello,

I have several config files prepared to be "loaded" and used in World Clock in different situations (different

I would like to simply "apply" those files and see the result, if possible by using a .BAT command file or, alternatively, by overwriting World Clock's config file with my own file in real time, and restarting the application.

Can anyone give me any pointers on how this can be achieved?

I am looking for:

1. Which file should be overwritten in order to pre-configure World Clock before being loaded? which folder?
2. Are there any command line switches that can be used when calling World Clock from a command line?

thanks in advance,
RTDIAS
rtdias
 
Posts: 2
Joined: Thu Sep 01, 2016 5:31 am

Re: Programmatically change World Clock Settings

Postby Nik » Fri Sep 02, 2016 7:28 pm

There are 2 config files, see https://www.anuko.com/world_clock/faq/w ... cation.htm

Available world_clock.exe command line switches:

* /exit - exit the application
* /restart - restart the application
* /import - import settings from file
* /export - export settings to file
* /nh - no hook, do not bother installing a taskbar clock
Nik
 
Posts: 330
Joined: Wed May 26, 2010 5:55 pm

Re: Programmatically change World Clock Settings

Postby rtdias » Mon Sep 05, 2016 3:02 am

Hello again,

I just wanted to update the community on this topic. Thanks Nik for your help.

My scenario is one where I am moving quite often between two different desks, let's say HOME and OFFICE, where my laptop sits on a docking station and is connected to one or multiple external screens.
Those screens have different resolutions, therefore, I would like to adjust the position of my clocks accordingly.

I've managed to successfully create a small .BAT file that can be run automatically at startup and will execute the following sequence:

1. Evaluate the size of my currently connected screen, storing a variable with that value
2. Exit World Clock in case it's running
3. Re-start World Clock with the appropriate .INI file for the screen I am currently using

I am sharing below my .BAT file with the community in case someone faces something similar.

I would also like to suggest that this feature could be built in World Clock app itself eventually?


***BEGINNING OF BAT FILE***
@echo off
REM Read Screen Size from WMIC

setlocal ENABLEDELAYEDEXPANSION
setlocal ENABLEEXTENSIONS
set wmicheight="wmic desktopmonitor get screenheight /format:value"
set wmicwidth="wmic desktopmonitor get screenwidth /format:value"

:height
for /f "tokens=2 delims==" %%a in ('%wmicheight%') do (
If %%a LEQ 1 (
rem skip if height is not bigger than 1
) Else (
rem take the first height value larger than 1
rem then skip to width
Set /a "height=%%a"
goto :width
)
)
:width
for /f "tokens=2 delims==" %%a in ('%wmicwidth%') do (
If %%a LEQ 1 (
rem skip if width is not bigger than 1
) Else (
rem add width found to get total width of all screens
REM Set /a "width=width+%%a"
Set /a "width=%%a"
)
)


REM echo %width%

REM Exit World Clock in case it's running

START "RTD" /B /D"C:\Program Files (x86)\Anuko\World Clock\" "world_clock.exe" /exit

REM Re-start World Clock with the right configuration file

IF %width%==1920 START "RTD" /D"C:\Program Files (x86)\Anuko\World Clock\" "world_clock.exe" /import "C:\Program Files (x86)\Anuko\World Clock\RTD_Clocks_1920x1200.ini"

IF %width%==2560 START "RTD" /D"C:\Program Files (x86)\Anuko\World Clock\" "world_clock.exe" /import "C:\Program Files (x86)\Anuko\World Clock\RTD_Clocks_2560x1440.ini"

***END OF BAT FILE***



regards,
Rtdias
rtdias
 
Posts: 2
Joined: Thu Sep 01, 2016 5:31 am


Return to World Clock

Who is online

Users browsing this forum: No registered users and 1 guest

cron