Skip to content

Instantly share code, notes, and snippets.

@jamesstout
Created March 23, 2013 09:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jamesstout/5227148 to your computer and use it in GitHub Desktop.
-- tip of the hat to Paul Calnan http://www.paulcalnan.com
-- for his Open Terminal Here extension that inspired this one
-- in fact half the code is nicked from him
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
-- make a new terminal
set myterm to (make new terminal)
tell myterm
-- set size
set number of columns to 80
set number of rows to 25
end tell
-- talk to the first terminal
tell myterm
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