AppleScript(Osscript):在iTerm 2中打开拆分窗格并执行命令 [英] Applescript (osascript): opening split panes in iTerm 2 and performing commands
本文介绍了AppleScript(Osscript):在iTerm 2中打开拆分窗格并执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下内容可在 iTerm 2 .
我似乎无法弄清楚如何使用拆分的窗格.
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
推荐答案
好的,所以我终于明白了.
Okay, so I finally figured this out.
通过将击键发送到应用程序,您可以打开和导航拆分窗格.
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(Osscript):在iTerm 2中打开拆分窗格并执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文