Skip to content

Instantly share code, notes, and snippets.

@samwestwood
Created December 6, 2012 12:39
Show Gist options
  • Save samwestwood/4224181 to your computer and use it in GitHub Desktop.
Save samwestwood/4224181 to your computer and use it in GitHub Desktop.
Alfred + iTerm + Terminal Here
-- Adapted from:
-- http://iterm.sourceforge.net/scripting.shtml and
-- https://github.com/egrouse/alfred-terminal-here/
set finderPath to ""
tell application "Finder"
try
set finderFolder to (folder of the front window as alias)
on error
set finderFolder to (path to home folder as alias)
end try
set finderPath to quoted form of POSIX path of finderFolder
end tell
tell application "iTerm"
activate
tell the first terminal
launch session "Default Session"
tell the last session
write text "cd " & finderPath
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment