Skip to content

Instantly share code, notes, and snippets.

@andrewodri
Created May 13, 2020 21:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewodri/e0440c52f7c0a7333c35ab6443581efe to your computer and use it in GitHub Desktop.
Save andrewodri/e0440c52f7c0a7333c35ab6443581efe to your computer and use it in GitHub Desktop.
Launch Terminal and close window when finished using AppleScript
tell application "Terminal"
activate
do script "sudo say --rate=140 \"Intergalactic Planetary\" && kill -9 $$"
delay 5
repeat
try
do shell script "ps a | grep -v grep | grep 'sudo say --rate=140 Intergalactic Planetary'"
delay 0.5
on error
exit repeat
end try
end repeat
close front window
end tell
@andrewodri
Copy link
Author

There is a some weirdness with how the ps command strips out quotes. IIRC, AppleScript like to "think different" when it comes to quotes as well. Use at your own risk 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment