Last active
September 2, 2018 15:34
-
-
Save botanicus/4ce9da88050a4301490c to your computer and use it in GitHub Desktop.
Launch iTerm2 session with 3 split windows and run commands in them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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