Created
February 21, 2015 17:13
-
-
Save mrspeaker/278091bd28a4fca79f37 to your computer and use it in GitHub Desktop.
Open iTerm at folder or file path
This file contains 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 "iTerm" | |
create window with default profile | |
tell current window | |
tell current session | |
set firstInput to (first item of input) | |
set fullPath to (firstInput as text) | |
if fullPath ends with ":" then | |
set outFolder to firstInput | |
else | |
tell application "System Events" | |
set outFolder to path of container of disk item (path of disk item (fullPath)) | |
end tell | |
end if | |
write text "cd " & quoted form of POSIX path of outFolder | |
end tell | |
end tell | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment