如何在iTerm上打开多个窗格?

时间:2016-06-11 16:30:34

标签: shell terminal applescript iterm panes

我创建了一些applecripts的别名来打开iTerm上的多个窗格。但是,自最新更新以来,脚本停止工作。我一直收到这个错误:

syntax error: Expected end of line but found identifier. (-2741)

这是脚本:

newPaneDown() {
osascript -e "
tell application \"iTerm\"
  make new terminal
  tell the current terminal
    activate current session
    tell the last session
      tell i term application \"System Events\" to key code 2 using {shift down, command down}
    end tell
  end tell
end tell"
}
newPaneLeft() {
osascript -e "
tell application \"iTerm\"
    make new terminal
    tell the current terminal
        activate current session
        tell the last session
            tell i term application \"System Events\" to key code 2 using command down
        end tell
    end tell
end tell"
}
newPanes4x4() {
/usr/bin/env osascript <<-EOF
tell application "iTerm"
    activate
        launch session "Panes"
        tell i term application "System Events" to keystroke "d" using command down
        tell i term application "System Events" to keystroke "D" using command down
        tell i term application "System Events" to keystroke "[" using command down
        tell i term application "System Events" to keystroke "[" using command down
        tell i term application "System Events" to keystroke "D" using command down
end tell
EOF
}
alias p2='newPaneLeft'
alias p3='newPaneDown && newPaneLeft'
alias p4='newPanes4x4'

1 个答案:

答案 0 :(得分:0)

自iTerm2 Version 3以来,Applescript不向后兼容。

新的Applescript语法描述为here。 你应该替换:

func parseCoupons(response : String) throws -> [Coupon]
{
  print("Starting to parse the file")
  let data = Data(response.utf8)

  let decoder = JSONDecoder()
  decoder.keyDecodingStrategy = .convertFromSnakeCase
  return try decoder.decode([Coupon].self, from: data)
}


make new terminal
相关问题