The following works to open two tabs in iTerm 2.
I can\'t seem to figure out how to get this to using split panes instead.
I\'ve tried appl
starting from @mklement0, this is my script that open a new tab, split in 4 panels and run comands:
#!/usr/bin/env bash
osascript <<-EOF
set cmds to {"rabbitmq-server", "mongod", "redis-server", "htop"}
tell application "iTerm"
activate
set myterm to (current terminal)
tell myterm
launch session "Default Session"
# split vertically
tell application "System Events" to keystroke "d" using command down
delay 1
# previus panel
tell application "System Events" to keystroke "[" using command down
delay 1
# split horizontally
tell application "System Events" to keystroke "d" using {shift down, command down}
delay 1
# next panel
tell application "System Events" to keystroke "]" using command down
delay 1
# split horizontally
tell application "System Events" to keystroke "d" using {shift down, command down}
set n to count of cmds
repeat with i from 1 to n
# next panel
tell application "System Events" to keystroke "]" using command down
delay 1
tell the current session to write text (item i of cmds)
end repeat
end tell
end tell
EOF