gpt4 book ai didi

terminal - Applescript(osascript): opening split panes in iTerm 2 and performing commands

转载 作者:行者123 更新时间:2023-12-02 04:06:55 25 4
gpt4 key购买 nike

以下方法可在 iTerm 2 中打开两个选项卡 .

我似乎不知道如何使用分割 Pane 来代替它。

我尝试应用我在几个论坛上看到的内容,但它从来没有奏效。有人能指出我正确的方向吗?

osascript <<-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

最佳答案

新的夜间构建非常好。尽管它是大约一年前实现的,但公共(public)版本中似乎缺少它: Source - AppleScriptTest.m

tell application "iTerm"
activate
select first window

# Create new tab
tell current window
create tab with default profile
end tell

# Split pane
tell current session of current window
split vertically with default profile
split vertically with default profile
end tell

# Exec commands
tell first session of current tab of current window
write text "cd ~/Developer/master-node"
write text "coffee"
end tell
tell second session of current tab of current window
write text "gulp w"
end tell
tell third session of current tab of current window
end tell
end tell

我为此搜索了太长时间,所以也许我可以帮助某人解决这个问题(可能是几周后我自己),因为这是我发现的第一件事。该解决方案甚至可以与激活的焦点跟随鼠标一起使用,而其他答案中缺少该功能。

关于terminal - Applescript(osascript): opening split panes in iTerm 2 and performing commands,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22339250/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com