用于最小化终端窗口的 AppleScript 出现错误

问题描述 投票:0回答:1

我经常运行多个终端窗口,以登录各种服务器进行工作。为了整理屏幕,我使用了一个 AppleScript,它可以最小化除最前面的窗口之外的所有窗口(类似于 Apple 菜单中应用程序的“隐藏其他窗口”)。自从升级到 MacOS Sonoma 以来,一直出现错误。

剧本是

tell application "Terminal"
    repeat with thewindow in (get every window where frontmost is false)
        set miniaturized of thewindow to true
    end repeat
end tell

当我运行它时,我收到错误:

错误“终端出现错误:AppleEvent 处理程序失败。”数字-10000

在脚本编辑器中,发生这种情况时,它会突出显示

every window where frontmost is false)

这个表情有什么问题吗?

macos applescript terminal.app
1个回答
0
投票

如果你尝试这样的事情会发生什么?我不经营索诺玛,所以这只是一个建议。

无论哪种方式,如果您将该行分成两部分(并在重复循环之前创建列表)可能会有所帮助。

tell application "Terminal"
    set ev to rest of (get every window)
    
    repeat with win in ev
        set miniaturized of win to true
    end repeat  
    
end tell
© www.soinside.com 2019 - 2024. All rights reserved.