-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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