Created
August 18, 2015 20:47
-
-
Save GrantGochnauer/42ff81ee69ac2a0c3f23 to your computer and use it in GitHub Desktop.
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 "Finder" | |
set pathList to (quoted form of POSIX path of (folder of the front window as alias)) | |
end tell | |
tell application "System Events" | |
set isRunning to (exists (processes where name is "iTerm2")) | |
end tell | |
tell application "iTerm" | |
set termCount to count of windows | |
if termCount is 0 then | |
set myTerm to (make new window) | |
else | |
set myTerm to the current window | |
end if | |
-- display dialog termCount | |
if isRunning and termCount is not 0 then | |
tell current window | |
create tab with profile "Default" | |
tell current session | |
write text "cd " & pathList | |
end tell | |
end tell | |
end if | |
activate | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment