Skip to content

Instantly share code, notes, and snippets.

@krid78
Created February 21, 2016 07:48
Show Gist options
  • Save krid78/efc58dd5a9907cf06da6 to your computer and use it in GitHub Desktop.
Save krid78/efc58dd5a9907cf06da6 to your computer and use it in GitHub Desktop.
Alfred iTerm2 (version 2) for '>'
-- http://www.alfredforum.com/topic/721-executing-iterm2-terminal-commands-in-current-shell/
on alfred_script(q)
tell application "iTerm"
activate
try -- We don't need error messages
set miniaturized of windows to false
end try
try
set _session to current session of current terminal
on error
set _term to (make new terminal)
tell _term
launch session "Default"
set _session to current session
end tell
end try
tell _session
write text q
end tell
end tell
tell application "System Events"
set visible of process "iTerm" to true
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment