Last active
July 28, 2016 13:45
-
-
Save suewonjp/6cb1c64274069a60286972085e234696 to your computer and use it in GitHub Desktop.
[Mac OS X Tip] Open a new iTerm tab from the current folder in Finder
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
on run {input, parameters} | |
tell application "Finder" | |
set dir_path to quoted form of (POSIX path of (folder of the front window as alias)) | |
end tell | |
CD_to(dir_path) | |
end run | |
on CD_to(theDir) | |
tell application "iTerm" | |
activate | |
try | |
set w to first window | |
on error | |
set w to (create window with default profile) | |
end try | |
tell w | |
tell (create tab with default profile) | |
launch session "Default Session" | |
tell current session | |
write text "cd " & theDir & ";clear;" | |
end tell | |
end tell | |
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
The above procedure is working on my system (OS X 10.11.5 and iTerm2 build 3.0.0)