Applescript 打开特定终端样式窗口

发布于 2024-12-10 16:50:06 字数 212 浏览 0 评论 0原文

好吧,事情就是这样。我希望每项工作都有不同风格的终端窗口。每个人都会有不同的工作,即,一个人将通过 ssh 连接到一个站点,另一个窗口连接到其他地方,等等。

所以我想这可以通过一些 Applescripting 来完成?

问题是有一些苹果脚本可以打开不同的终端窗口。然后将每个 applescript 添加到快捷方式。

有什么想法吗?

谢谢 :)

Ok, so the thing is. I want to have different style terminal windows for each job. Each one will have a different job, i.e. , one will connect through ssh to a site, other window to other place, etc.

So I guess this could be done with some Applescripting?

The thing would be to have some applescripts that opens a different terminal window. And then add each applescript to a shortcut.

Any ideas?

Thanks :)

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

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

发布评论

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

评论(2

拿命拼未来 2024-12-17 16:50:06

在终端中设置一个窗口组怎么样?

打开您想要的所有终端窗口 -->壳牌-->显示检查员。在“设置”下,您可以更改每个终端窗口的主题。

窗口-->将 Windows 另存为组

在首选项中设置启动选项以显示组。

http://img18.imageshack.us/img18/9681/screenshot20111018at110.png
http://img542.imageshack.us/img542/9681/screenshot20111018at110.png

如果您想使用 Applescript 设置窗口的主题,您可以首先需要使用此 applescript 获取所有主题的 id:

set a to {}
tell application "Terminal"
    repeat with i from 1 to count settings set
        set temp to {settings set i's name, settings set i's id}
        set end of a to temp
    end repeat
    a
end tell

这将输出 id # 和主题名称的数组。接下来要创建一个新窗口,请使用以下命令:

tell application "Terminal"
    set a to do script "" -- creates new window
    set a's current settings to (settings set id <one of the id #>)
end tell

How about setting up a Window group in terminal ?

Open all Terminal windows you want --> Shell --> Show Inspector. Under Settings you can change the theme of each terminal window.

Window --> Save Windows as Group

In preferences set the startup option to display the group.

http://img18.imageshack.us/img18/9681/screenshot20111018at110.png
http://img542.imageshack.us/img542/9681/screenshot20111018at110.png

If you want to use Applescript to set a window's theme you first need to get the id's of all the themes you have using this applescript :

set a to {}
tell application "Terminal"
    repeat with i from 1 to count settings set
        set temp to {settings set i's name, settings set i's id}
        set end of a to temp
    end repeat
    a
end tell

This will output an array of id # and the theme's name. Next to create a new window use the following :

tell application "Terminal"
    set a to do script "" -- creates new window
    set a's current settings to (settings set id <one of the id #>)
end tell
我偏爱纯白色 2024-12-17 16:50:06

告诉应用程序“系统事件”告诉进程“终端”点击菜单栏1的菜单栏项“Shell”的菜单1的菜单项“新窗口”的菜单1的菜单项“草”


tell application "Terminal"
    set win to do script
    set win's current settings to settings set "Basic"
end tell

tell application "System Events" to tell process "Terminal" to click menu bar 1's menu bar item "Shell"'s menu 1's menu item "New Window"'s menu 1's menu item "Grass"


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