Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created February 21, 2015 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrspeaker/278091bd28a4fca79f37 to your computer and use it in GitHub Desktop.
Save mrspeaker/278091bd28a4fca79f37 to your computer and use it in GitHub Desktop.
Open iTerm at folder or file path
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