iTerm applescript 在两个独立的垂直窗格中书写

iTerm applescript to write in two seperate verticle panes

我正在尝试编写一个 applescript: - 打开一个新的 window - 更改目录 - 将窗格垂直拆分到同一目录 - 在左窗格中写入文本 - 在右窗格中写入文本

如果可能,然后同时执行两个窗格。

我能得到的最接近的是做类似的事情,但打开两个单独的 windows。像这样:

    tell application "iTerm"
       set myterm to create window with default profile
       tell myterm
          activate current session
          launch session "Default Session"
          tell the current session
             write text "cd ~/Desktop"
             write text "xcodebuild clean -workspace -scheme WelcomeScreenTests -sdk iphonesimulator -destination 'platform=iOS Simulator,id=476E9E8C-8248-4EF6-8054-67900D603E83'  test | xcpretty"
          end tell
    end tell
    set myterm to create window with default profile
    tell myterm
       activate current session
       launch session "Default Session"
       tell the current session
          write text "cd ~/Desktop"
          write text "xcodebuild clean -workspace -scheme WelcomeScreenTests2 -sdk iphonesimulator -destination 'platform=iOS Simulator,id=F3DEA448-147B-4DDB-AD83-16D18BA1A87F' test | xcpretty"
       end tell
    end tell

如有帮助将不胜感激

有可能。

tell application "iTerm"
    set myterm to create window with default profile
    tell myterm
        activate current session
        launch session "Default Session"
        tell the current session
            write text "cd ~/Desktop"

            -- use 'without newline' to write without executing the command
            write text "xcodebuild clean -workspace -scheme WelcomeScreenTests -sdk iphonesimulator -destination 'platform=iOS Simulator,id=476E9E8C-8248-4EF6-8054-67900D603E83'  test | xcpretty" without newline
            tell (split vertically with same profile)
                write text "cd ~/Desktop"

                -- use 'without newline' to write without executing the command
                write text "xcodebuild clean -workspace -scheme WelcomeScreenTests2 -sdk iphonesimulator -destination 'platform=iOS Simulator,id=F3DEA448-147B-4DDB-AD83-16D18BA1A87F' test | xcpretty" without newline
            end tell
        end tell
        write (sessions of current tab) text linefeed -- append newline to the last line of each session to executes both panes simultaneously.
    end tell
end tell