本文介绍了Applescript (osascript):在 iTerm 2 中打开拆分窗格并执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下用于在 iTerm 2标签/a>.
我似乎无法弄清楚如何使用拆分窗格来代替.
I can't seem to figure out how to get this to using split panes instead.
我已经尝试应用我在几个论坛上看到的内容,但始终没有奏效.有人能指出我正确的方向吗?
I've tried applying what I see on several forums, but it never works. Could someone point me in the right direction?
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
推荐答案
好吧,我终于想通了.
通过向应用程序发送击键,您可以打开和导航拆分窗格.
By sending keystrokes to the application, you can open and navigate split-pane.
tell i term application "System Events" to keystroke "D" using command down
tell i term application "System Events" to keystroke "]" using command down
发送命令以拆分窗格并命名每个窗格的示例.我用它来启动我的节点应用程序.
An example sending commands to split pane and naming each pane. I use this to start my node application.
write text "cd $projectsFolder/$2.m"
write text "/usr/local/bin/frontend.sh $1 $2"
tell i term application "System Events" to keystroke "D" using command down
tell i term application "System Events" to keystroke "]" using command down
set name to "$2.api"
write text "cd $projectsFolder/$2.api"
write text "/usr/local/bin/backend.sh $1 $2"
这篇关于Applescript (osascript):在 iTerm 2 中打开拆分窗格并执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!