使用Applescript取消最小化应用程序

ric*_*fox 11 macos applescript

我正在尝试编写一个脚本来取消最小化以前最小化停靠的应用程序.问题是,我找不到相关的财产.我试过了miniaturized,collapsed但窗户和过程似乎都没有?

我使用的应用程序(用于测试)是Zipeg,一个免费的打包​​工具.

我也尝试点击按钮,快乐地最小化应用程序,但是在已经最小化的应用程序上运行时给我一个错误来恢复它,可能是因为没有窗口可见.这个脚本如下.

tell application "System Events"
    tell process "Zipeg"
        click button 1 of window 1
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)

我用来列出属性的脚本如下.

tell application "System Events"
    tell process "Zipeg"
        get properties
        tell window 1
            get properties
        end tell
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Lri*_*Lri 13

tell app (path to frontmost application as text)
    try
        set miniaturized of windows to false -- most apps
    end try
    try
        set collapsed of windows to false -- Finder
    end try
end tell
Run Code Online (Sandbox Code Playgroud)

如果未选中将窗口最小化为应用程序图标,则会最小化单个窗口:

try
    tell app "System Events" to tell process "Dock"
        click (last UI element of list 1 where role description is "minimized window dock item")
    end tell
end try
Run Code Online (Sandbox Code Playgroud)

如果应用程序的所有窗口都被最小化,则最小化reopen第一个:

tell app "TextEdit"
    reopen -- unminimizes the first minimized window or makes a new default window
    activate -- makes the app frontmost
end tell
Run Code Online (Sandbox Code Playgroud)

  • 重新打开是我正在寻找的。谢谢! (2认同)