Skip to content

Instantly share code, notes, and snippets.

@nathancahill
Created August 10, 2018 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathancahill/2e54f76c76da257c4cdd3fbafccbc3fd to your computer and use it in GitHub Desktop.
Save nathancahill/2e54f76c76da257c4cdd3fbafccbc3fd to your computer and use it in GitHub Desktop.
tell application "Finder"
set this_folder to (the target of the front window) as alias
set thePath to quoted form of POSIX path of this_folder
set theCmd to "cd " & thePath & ";clear;"
end tell
tell application "iTerm"
activate
set aWindow to current window
if aWindow is equal to missing value then
set aWindow to (create window with default profile)
else
tell aWindow
set t to (create tab with default profile)
end tell
end if
tell current session of aWindow
write text theCmd
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment