How do I enable the “Announce the time” option in the Date & Time System Preference using Applescript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this via a terminal command:
defaults writeI managed to dig out the preference file that’s being written to when you toggle this setting:
~/Library/Preferences/com.apple.speech.synthesis.general.prefs.plist. Note that this file may not exist on your computer; it’s only created if you’ve toggled the “Announce the time” checkbox in System Prefs.The key you’re changing the value for is
TimeAnnouncementsEnabled, which takes a boolean value ofYESto turn on the announcements andNOfor off. This key is inside of the dictionaryTimeAnnouncementPrefswhich houses the other settings related to the voice announcements. The terminal command to turn on the time announcements is:To use this in an AppleScript simply do the following (to run a terminal command from AppleScript):
That should do it. The other preference keys (voice, custom rate and custom volume) will be reset to their defaults if you use the command as above. If you want to set them to non-default values you’ll have to explicitly set them along with the above key value. However, since there are some nested dictionaries you’d probably need to look at using plistbuddy (which isn’t installed by default AFAIK). However, if you only want to set the announcement on/off option, don’t worry about it. This will set you up!