取消最小化Applescript的应用程序

问题描述:

我正在尝试编写脚本以取消最小化以前最小化的应用程序以停靠。 问题是,我无法找到相关的属性。我试过miniaturizedcollapsed,但窗口和过程似乎都没有?取消最小化Applescript的应用程序

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

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

tell application "System Events" 
    tell process "Zipeg" 
     click button 1 of window 1 
    end tell 
end tell 

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

tell application "System Events" 
    tell process "Zipeg" 
     get properties 
     tell window 1 
      get properties 
     end tell 
    end tell 
end tell 

任何想法?

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 

这unminimizes单个窗口如果最小化窗口到应用程序图标未选中:

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 

如果某个应用的所有窗口被最小化,reopen unminimizes第一个:

tell app "TextEdit" 
    reopen -- unminimizes the first minimized window or makes a new default window 
    activate -- makes the app frontmost 
end tell 
+0

重新开放是我waas寻找。谢谢! – rickythefox

如果你tell application "App" to activate如果所有窗口都被最小化,它将不会最小化一个窗口。

+0

不,不适用于应用程序。也尝试与iTunes(告诉应用程序“iTunes”激活),并不在那里工作...它激活并显示应用程序的菜单,但没有窗口。 – rickythefox

+0

嗯......它没有。我认为“激活”应该等同于点击Dock图标。 – CajunLuke

+0

@CajunLune'reopen'相当于点击Dock图标。如果没有打开的窗口,它会取消最小化第一个窗口或创建一个新的默认窗口。 – user495470

这应该为你工作:

tell application "Safari" 
    activate 
    set index of window 1 to 1 
end tell 

尝试沿着这些路线的东西。

tell application "Finder" to set collapsed of every window to false 
+0

正如我上面写的那样,问题窗口没有“折叠”属性。上面的代码适用于Finder,但我的应用程序有另一组属性。 – rickythefox