[英]Run a command in a new tab in terminal
I'm trying to write a script that could run several commands in several tabs in the terminal. 我正在尝试编写一个可以在终端的多个选项卡中运行多个命令的脚本。 I found a lot of informations about it, but it doesn't work as I want it to.
我发现了很多关于它的信息,但它并不像我想要的那样工作。 So I probably need AppleScript.
所以我可能需要AppleScript。
• This code run a command in a new window: •此代码在新窗口中运行命令:
tell app "Terminal"
do script "echo hello"
end tell
• And this one open a new tab •这一个打开一个新选项卡
tell application "Terminal"
activate
tell application "System Events"
keystroke "t" using {command down}
end tell
end tell
But I didn't figured out how to "mix" them. 但我没想出如何“混合”它们。 Any idea ?
任何的想法 ?
tell application "Terminal"
activate
tell application "System Events"
keystroke "t" using {command down}
end tell
do script "echo hello" in selected tab of the front window
end tell
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.