I like Time Announce during the day while I am working. But I want it off when I am sleeping.
Apple's Do Not Disturb function will mute notifications and sounds associated with them, but it has no effect on Time Announce.
Elsewhere on this site there is an old answer from a number of years ago that offered this script:
do shell script "defaults write ./com.apple.speech.synthesis.general.prefs TimeAnnouncementPrefs -dict TimeAnnouncementsEnabled -bool YES"
Similar script to turn it off.
Another answer can be found here, but goes back to the days of Mountain Lion:
How do I enable "Announce the time" programmatically?
I am new here and a rank beginner to Aapplescript. I do not have the privilege of commenting yet to seek clarification from the authors of the answers presented.
These scripts do not work on Mac OS X High Sierra (10.13). While the first script will compile, when run nothing happens. The script from the page referenced won't even compile. Syntax error about an unknown token after an identifer.
In addition, making a change manually to this preference in settings requires my password to unlock. Can AppleScript or Automator deal with that too?
Best Answer
UPDATE: This works for me using the latest version of High Sierra.
This version will "turn on" "Announce the time:" if not already enabled
This version will "turn off" "Announce the time:" if already enabled
I could have set the script to perform the action of clicking checkbox "Announce the time:" if it was not enabled already… with conditional statements of setting enabled or disabled of that checkbox during certain times. I figured, for now, it would just be easier to save two different versions of the script. One version for turning on checkbox "Announce the time:" and one version for turning off checkbox "Announce the time:”. In ScriptEditor, just saved each version of the script as applications. From there just simply open Calendar.app and create two new calender events. one event for enabling checkbox "Announce the time:" at whatever time you choose. And another for disabling.. Once you create the event, just create a custom alert and select the option of open file then choose your script which you saved as an app.