on is_running(app_name)
tell application "System Events" to (name of processes) contains app_name
end is_running
on run_script(q)
if is_running("iTerm2") or is_running("iTerm") then
run script "
on run {q}
tell application \":Applications:iTerm.app\"
activate
select first window
set onlywindow to true
tell the first window
if onlywindow is false then
create tab with default profile
end if
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
else
run script "
on run {q}
tell application \":Applications:iTerm.app\"
activate
try
select first window
on error
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
end if
end run_script
on alfred_script(p)
run_script("cd ~/_workspace/yak/yak")
if p is "s" then
run_script("rails s")
end if
end alfred_script
Last active
October 13, 2015 08:23
-
-
Save SaKKo/9b1ffc44ef7e5d3f370e to your computer and use it in GitHub Desktop.
Alfred2 iTerm2-9 Apple Script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment