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 applying what I see on several forums, but it never works. Could someone point me in the right direction?
osascript <<-eof
tell application "iterm"
set myterm to (make new terminal)
tell myterm
launch session "Default session"
tell the last session
set name to "Server"
write text "cd $projectsFolder"
end tell
launch session "Default session"
tell the last session
set name to "Console"
write text "cd $projectsFolder"
end tell
end tell
end tell
eof
Okay, so I finally figured this out.
By sending keystrokes to the application, you can open and navigate split-pane.
tell i term application "System Events" to keystroke "D" using command down
tell i term application "System Events" to keystroke "]" using command down
An example sending commands to split pane and naming each pane. I use this to start my node application.
write text "cd $projectsFolder/$2.m"
write text "/usr/local/bin/frontend.sh $1 $2"
tell i term application "System Events" to keystroke "D" using command down
tell i term application "System Events" to keystroke "]" using command down
set name to "$2.api"
write text "cd $projectsFolder/$2.api"
write text "/usr/local/bin/backend.sh $1 $2"