Skip to content

Instantly share code, notes, and snippets.

@jamespan
Created June 19, 2014 06:33
Show Gist options
  • Save jamespan/7c9c256ab0d6d7b119b2 to your computer and use it in GitHub Desktop.
Save jamespan/7c9c256ab0d6d7b119b2 to your computer and use it in GitHub Desktop.
OpenInTerminal.applescript
-- OpenInTerminal.applescript
-- ForkLift
-- Created by JamesPan
tell application "System Events"
set appWasRunning to exists (processes where name is "iTerm")
tell application "iTerm"
activate
if not appWasRunning then
terminate the first session of the first terminal
end if
set myterm to (make new terminal)
-- talk to the new terminal
tell myterm
-- launch a default shell in a new tab in the same terminal
launch session "Default Session"
tell the last session
write text "cd _forklift_path_placeholder_ ;clear"
end tell
activate
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment