title: Applescript (osascript): opening split panes in iTerm 2 and performing commands
body: <p>The following works to open two <em>tabs</em> in <a href="http://www.iterm2.com/#/section/features/split_panes" rel="noreferrer">iTerm 2</a>.</p>
  
  <p>I can't seem to figure out how to get this to using split <em>panes</em> instead.</p>
  
  <p>I've tried applying what I see on several forums, but it never works. Could someone point me in the right direction?</p>
  
  <pre class="lang-applescript prettyprint-override"><code>osascript &lt;&lt;-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
  </code></pre>