Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Launch Terminal and close window when finished using AppleScript
tell application "Terminal"
do script "sudo say --rate=140 \"Intergalactic Planetary\" && kill -9 $$"
delay 5
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

This comment has been minimized.

Copy link
Owner Author

andrewodri commented May 13, 2020

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
You can’t perform that action at this time.