Skip to content

Instantly share code, notes, and snippets.

@eplt
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eplt/9524703 to your computer and use it in GitHub Desktop.
Save eplt/9524703 to your computer and use it in GitHub Desktop.
An AppleScript to switch the Text-To-Speech voice from Daniel to Ting-Ting and vice versa. I use it because I often have to switch between English and Chinese TTS. I found this script online and modified it.
tell application "System Preferences"
activate
reveal anchor "TTS" of pane "com.apple.preference.speech"
end tell
tell application "System Events" to tell process "System Preferences"
tell pop up button 1 of tab group 1 of window 1
click
delay 0.5 -- without this the value was sometimes "Loading Voices…"
if value is "Daniel" then
click menu item "Ting-Ting" of menu 1
else
click menu item "Daniel" of menu 1
end if
end tell
end tell
quit application "System Preferences"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment