使用 AppleScript 设置终端选项卡名称

发布于 2024-12-27 13:44:48 字数 234 浏览 3 评论 0原文

我有以下脚本,它打开终端,连接到远程主机并在那里启动脚本:

tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window    
end tell

如何设置此终端选项卡的名称?

I have the following script, which opens Terminal, connects to a remote host and launches a script there:

tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window    
end tell

How can I set the name for this Terminal tab?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

快乐很简单 2025-01-03 13:44:48
tell app "Terminal" to set custom title of tab 1 of front window to "my tab name"
tell app "Terminal" to set custom title of tab 1 of front window to "my tab name"
你怎么这么可爱啊 2025-01-03 13:44:48
tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window 
    set input to "\"\\033]0;<your title here>\\007\""
    do script "echo -n -e " & input   
end tell

替换为您希望的标题文本。

tell application "Terminal"
    activate
    do script "ssh me@myserver" 
    delay 10
    do script "sh ./startserver" in front window 
    set input to "\"\\033]0;<your title here>\\007\""
    do script "echo -n -e " & input   
end tell

Replace <your title here> with whatever text you wish your title to be.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文