Skip to content

Instantly share code, notes, and snippets.

@hems
Created June 7, 2014 21:42
Show Gist options
  • Save hems/98d29e08818235cb372f to your computer and use it in GitHub Desktop.
Save hems/98d29e08818235cb372f to your computer and use it in GitHub Desktop.
Dividing iTerm screen and running different commands on each division
# makefile
iterm:
osascript ./start_iterm.scpt $(PWD)
# start_iterm.scpt
on run argv
launch "iTerm"
tell application "iTerm"
activate
-- my project workspace
set myterm to (make new terminal)
tell myterm
launch session "wagon"
set number of columns to 160
set number of rows to 40
-- create wagon server
tell the current session to write text "cd " & item 1 of argv
tell the current session to write text "make server"
-- watch polvo
tell i term application "System Events" to keystroke "D" using command down
-- need a delay after keystroking
delay 0.1
tell the current session to write text "cd " & item 1 of argv
tell the current session to write text "make polvo_watch"
-- watch images
tell i term application "System Events" to keystroke "[" using command down
tell i term application "System Events" to keystroke "d" using command down
-- need a delay after keystroking
delay 0.1
tell the current session to write text "cd " & item 1 of argv
tell the current session to write text "make images_watch"
tell i term application "System Events" to keystroke "]" using command down
tell i term application "System Events" to keystroke "d" using command down
-- need a delay after keystroking
delay 0.1
tell the current session to write text "cd " & item 1 of argv
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment