Skip to content

Instantly share code, notes, and snippets.

@1syo
Last active June 18, 2017 13:43
Show Gist options
  • Save 1syo/5c50bd3b768102027dc98901ced56e49 to your computer and use it in GitHub Desktop.
Save 1syo/5c50bd3b768102027dc98901ced56e49 to your computer and use it in GitHub Desktop.
on alfred_script(q)
tell application "System Events"
if not (exists (processes where name is "Terminal")) then
tell application "Terminal"
activate
do script q in first window
end tell
else
tell application "Terminal"
activate
if (count of windows) is 0 then
do script
do script q in first window
else
tell application "System Events" to tell process "Terminal.app" to keystroke "t" using command down
delay 1
do script q in first window
end if
end tell
end if
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment