4

I like the built-in time announcement in OS X. But my wife has forbidden it because it announces time at night too. Is there any way to silence during certain hours or some other utility that will announce the time?

I am aware of Cuckoo, but it only does chimes.

2

I would use applescript and iCal to schedule enabling and disabling this feature. On OSX Lion you'll need to have 2 scripts one to enable it and one to disable it.

This is the script to enable save it somewhere in your home directory I called it time_announce_on.applescript :

do shell script "defaults write ./com.apple.speech.synthesis.general.prefs TimeAnnouncementPrefs -dict TimeAnnouncementsEnabled -bool YES"

Then in iCal setup an appointment to recur every morning at the specified time you want to enable the announcements and have the alert 'run script' and load the above script.

Then all you need to do is have the disable script which I called time_announce_off.applescript :

do shell script "defaults write ./com.apple.speech.synthesis.general.prefs TimeAnnouncementPrefs -dict TimeAnnouncementsEnabled -bool NO"

Then setup another appointment in iCal for the time of night that you want to disable this and have it run the time_announce_off script.

I tested this in Lion 10.7.3 and it works. For 10.6 I believe you just need to remove the ./ from the beginning of the com.apple.speech.synthesis.general.prefs (but I haven't tested this).

0

Easy Fix Via Terminal, If That's Cool

If you're still having this issue, it's annoying, but here's a simple way as of Big Sur, in the Terminal:

Turn "Announce the Time" On

plutil -replace TimeAnnouncementPrefs.TimeAnnouncementsEnabled -bool YES /Users/macbook/Library/Preferences/com.apple.speech.synthesis.general.prefs.plist; defaults read com.apple.speech.synthesis.general.prefs.plist;

Turn "Announce the Time" Off

plutil -replace TimeAnnouncementPrefs.TimeAnnouncementsEnabled -bool NO ~/Library/Preferences/com.apple.speech.synthesis.general.prefs.plist; defaults read com.apple.speech.synthesis.general.prefs.plist;

Scheduling

Keep it simple. Use crontab.

#m      h       dom     mon     dow     command
5       23      *       *       *       plutil -repla...
5       7       *       *       *       plutil -repla...

Stating obvious, use the full line (on a single line) vs the ellipses... If you're not familiar with crontab, you can cheat and just use this site (or many others) to generate the full line for you.

Explanation

The first line is an edit command using plutil in the terminal to edit the preferences in com.apple.speech.synthesis.general.prefs.plist.

You can use plutil to view the preferences in the terminal as follows:

plutil -p ~/Library/Preferences/com.apple.speech.synthesis.general.prefs.plist

...which in Big Sur, shows...

{
  "TimeAnnouncementPrefs" => {
    "TimeAnnouncementsEnabled" => 0
    "TimeAnnouncementsIntervalIdentifier" => "EveryHourInterval"
    "TimeAnnouncementsPhraseIdentifier" => "ShortTime"
    "TimeAnnouncementsVoiceSettings" => {
      "CustomVolume" => 0.1148504
    }
  }
}

The TimeAnnouncementPrefs.TimeAnnouncementsEnabled is the BOOL switch we're toggling on and off with the -bool YES or -bool NO. I'm sure the other settings do something, but honestly, not enough time in the day. I'm simple... on switch/off switch.

The second line forces the Mac to reload that pref so you don't need to kill any apps or reboot. If you don't run the second command, the change won't take effect until you reboot or force kill it. (For the CLI folks, it's the Mac equivalent of source ~/.bash_profile when changing PATHs or aliases or whatnot.

Note if you have the System Preferences -> Dock & Menu Bar -> Clock open in prefs when you do this, the UI will NOT reload to reflect the changes. Close Systems Preferences entirely (vs. arrow back) and reopen (don't save), and you'll see the change reflected. If you don't, the pref is still changed but you run the risk of saving over it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .