小编Sar*_*and的帖子

打开、拆分 iTerm2 窗口并在每个窗格中执行命令

我正在尝试创建一个脚本,该脚本将打开一个iTerm2窗口,将其垂直分成 3 个窗格,并在每个窗格中运行一些命令。

\n\n

这是我迄今为止的尝试:

\n\n
tell application "iTerm2"\n  activate\n\n  -- Create main window\n  create window with default profile\n\n  tell current session of current window\n    set name to "frontend"\n    write text "cd ~/Documents/frontendDir"\n    split vertically with default profile\n  end tell\n\n  tell second session of current window -- ERROR HERE\n    set name to "backend"\n    write text "cd ~/Documents/backendDir"\n    split vertically with default profile\n  end tell\n\n  tell third session of current window\n    set name to "apollo-server"\n    write text "cd ~/Documents/GitHub/apolloDir"\n …
Run Code Online (Sandbox Code Playgroud)

macos applescript iterm2

3
推荐指数
1
解决办法
3210
查看次数

标签 统计

applescript ×1

iterm2 ×1

macos ×1