2017-09-13 56 views
1

我想寫一個AppleScript是寫: - 打開一個新窗口 - 改變目錄 - 拆分窗格垂直放到同一個目錄 - 在左窗格中 寫的文字 - 在右窗格中的iTerm的AppleScript在兩個不同的verticle窗格

寫入文本,如果可能,然後同時執行兩個窗格。

我能得到的最接近的是做類似的,但開兩個獨立的窗口。像這樣:

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 

任何幫助將是巨大的感謝

回答

1

這是可能的。

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 
+0

驚人謝謝! – Wazza

相關問題