Skip to content

Instantly share code, notes, and snippets.

@yuhonas
Created November 21, 2012 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yuhonas/4122118 to your computer and use it in GitHub Desktop.
Save yuhonas/4122118 to your computer and use it in GitHub Desktop.
iTerm / Sublime AppleScript
tell application "System Events"
# create an iTerm session if we dont have one
if not (exists (processes where name is "iTerm")) then
tell application "iTerm" to (make new terminal)
end if
tell application "iTerm"
activate
tell the current terminal
set SublimeSessionName to "sublime"
set SublimeSession to false
# loop through all our iterm sessions looking for our sublime session
repeat with iTermSession in sessions
if name of iTermSession is SublimeSessionName then
set SublimeSession to iTermSession
exit repeat
end if
end repeat
# create the session if we cant find our beloved sublime session
if SublimeSession is false then
set SublimeSession to (make new session at the end of sessions)
tell SublimeSession
set name to SublimeSessionName
#set background color to "blue"
end tell
end if
select SublimeSession
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment