Created
May 13, 2020 21:44
-
-
Save andrewodri/e0440c52f7c0a7333c35ab6443581efe to your computer and use it in GitHub Desktop.
Launch Terminal and close window when finished using AppleScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 🤷♂️