Skip to content

Instantly share code, notes, and snippets.

@defmech
Created January 24, 2022 20:01
Show Gist options
  • Save defmech/16eb77f1bca590b5e418735c4f23c6d9 to your computer and use it in GitHub Desktop.
Save defmech/16eb77f1bca590b5e418735c4f23c6d9 to your computer and use it in GitHub Desktop.
AppleScript version of Go2Shell
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"
if not (exists (processes where name is "iTerm2")) then
do shell script "open -a iTerm " & pathList
else
tell application "iTerm"
set newWindow to (create window with default profile)
tell current session of newWindow
write text "cd " & pathList & " && clear"
end tell
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment