Skip to content

Instantly share code, notes, and snippets.

@maxrothman
Created January 8, 2015 19:09
Show Gist options
  • Save maxrothman/98ba2af4b2f1dd7df93f to your computer and use it in GitHub Desktop.
Save maxrothman/98ba2af4b2f1dd7df93f to your computer and use it in GitHub Desktop.
Open iTerm to current Finder directory automator application
-- Add a button to Finder that opens iTerm to the current directory
-- Inspired by http://peterdowns.com/posts/open-iterm-finder-service.html
-- but updated to use the new iTerm nightly build AppleScript API and OSX 10.9.5 AppleScript
-- Setup (same as above link):
-- - Create a new Automator Application
-- - Add a "Run AppleScript" action
-- - Paste this in and save
-- - with Command-drag the application to the top bar in Finder
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (the target of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(q)
tell application "iTerm"
create window with default profile
tell current session of last terminal window
write text "cd " & q & "; clear"
end tell
end tell
end CD_to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment