Skip to content

Instantly share code, notes, and snippets.

@jeanpimentel
Forked from botanicus/PPT.applescript
Created August 19, 2018 22:38
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 jeanpimentel/b7bdc4cf16b147ee4b8fd71a6c1bcafa to your computer and use it in GitHub Desktop.
Save jeanpimentel/b7bdc4cf16b147ee4b8fd71a6c1bcafa to your computer and use it in GitHub Desktop.
Launch iTerm2 session with 3 split windows and run commands in them.
-- Find more at http://iterm.sourceforge.net/scripting.shtml
launch "iTerm"
tell application "iTerm"
activate
-- ssh in split panes to my varnish stack
set myterm to (make new terminal)
tell myterm
-- Use PPT *profile*
launch session "PPT"
-- Split window #1.
tell the last session to write text "cd ~/Dropbox/Projects/PPT/source"
tell the last session to write text "vagrant up"
delay 1
tell i term application "System Events" to keystroke "k" using command down
-- Split window #2.
tell i term application "System Events" to keystroke "d" using command down
delay 2 -- Otherwise last session is not the new one, but rather the first one.
-- Also, the the CWD would be the default rather than the one of the last session.
tell the last session to write text "vagrant ssh"
-- Split window #3.
tell i term application "System Events" to keystroke "D" using command down
tell the last session to write text "vagrant ssh"
end tell
end tell
-- Fullscreen.
set bid to id of application "iTerm"
tell application "System Events" to tell (process 1 where bundle identifier is bid)
click (button 1 of window 1 where subrole is "AXFullScreenButton")
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment