Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Forked from rwilcox/open_here.applescript
Created August 17, 2013 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonpittman/6254687 to your computer and use it in GitHub Desktop.
Save brandonpittman/6254687 to your computer and use it in GitHub Desktop.
Fixed script to work even when a terminal window isn't already open.
tell application "BBEdit" to set theFile to file of document 1
tell application "Finder" to set theFolder to (container of file theFile) as alias
set theUnixPath to POSIX path of theFolder
tell application "iTerm"
make new terminal
tell the first terminal
-- launch a default shell in a new tab in the same terminal
launch session "Default Session"
tell the last session
write text "pushd \"" & theUnixPath & "\""
activate
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment