Frage

I want to read the various Date and Time related values the user sets through system preference.The Clock tab of Date & Time settings various settings.enter image description here

Now i wan to read weather the user changed Time Options, want to detect if its enabled or not? and also want to get notification whenever user changes these settings?

War es hilfreich?

Lösung

Just to emphasise my point in my comments. This is how you can read the clocks preferences via objective-c;

 CFStringRef appID;
CFPropertyListRef newCP;

appID = CFSTR("com.apple.menuextra.clock");
CFStringRef Key = CFSTR("IsAnalog");
 newCP  = CFPreferencesCopyAppValue (
                                         Key,
                                          appID
                                             );

 NSLog(@" newCP %@", newCP);

or in Applescript:

set theClock to quoted form of (do shell script "read com.apple.menuextra.clock  IsAnalog ")

But without knowing more this maybe a pointless answer.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top