Skip to content

Instantly share code, notes, and snippets.

@vgan
Created February 4, 2017 16:20
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 vgan/54a404969c5b141bc89cf7ead83dde34 to your computer and use it in GitHub Desktop.
Save vgan/54a404969c5b141bc89cf7ead83dde34 to your computer and use it in GitHub Desktop.
Generates a sentence using MacOS QuickType and speaks it with Daniel.
tell application "TextEdit"
activate
make new document at the front
end tell
tell application "System Events"
repeat 10 times
key code 53 using {option down}
key code 49
end repeat
key code 53 using {option down}
keystroke ". "
end tell
tell application "TextEdit"
set theText to (the text of the front document) as string
say theText using "Daniel"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment