Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The "Date & Time" System Preferences pane has an option to "Announce the time". I'd like to be able to turn on this preference option by invoking a shell script. Is this possible?

(It's fine if this involves invoking a separate script written in Applescript).

share|improve this question

1 Answer 1

up vote 1 down vote accepted

That preference seems to be stored in com.apple.speech.synthesis.general.prefs

Try this:

defaults write com.apple.speech.synthesis.general.prefs TimeAnnouncementPrefs -dict-add TimeAnnouncementsEnabled 1

or 0 at the end to turn it off. See man defaults for more info.

Edit: Another thing that the shell script should do: if you haven't enabled this preference or another speech synthesis behavior since startup, you'll also need to launch the Speech Synthesis Server daemon:

open /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesisServer.app

otherwise, the option will show up as checked in System Preferences, but nothing will actually read the option when it is time to speak the time.

share|improve this answer
    
Note that while this does make this option appear enabled when looking in Preferences, it does not actually enable the behavior (at least, not on Mountain Lion). Bug, perhaps? –  Lorin Hochstein Jul 31 '12 at 13:07
    
I wonder if some daemon program has to be restarted for this to take effect. Have you tried restarting the computer after running this script to see if it turns on then? –  mckeed Jul 31 '12 at 20:23
    
I haven't tried, but that would make the script pretty useless if I needed to reboot! Note that just unchecking and checking the box manually works properly. –  Lorin Hochstein Jul 31 '12 at 20:57
    
I was thinking about what needs to be added to the script. Maybe when you check the box manually, it both updates the setting and launches a daemon program that handles the time announcement. I'll look and see if I can figure it out when I have some time. –  mckeed Aug 2 '12 at 1:28
1  
Curiosity got the better of me, and I investigated and updated my answer. Please let me know if this fixes it for you. –  mckeed Aug 2 '12 at 1:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.