使用Applescript最小化应用程序 [英] Un-minimizing an app with Applescript
问题描述
我正在尝试编写脚本来取消最小化以前已最小化以停靠的应用程序.
问题是,我找不到相关属性.我已经尝试过miniaturized
和collapsed
,但是窗口或进程似乎都没有这些?
I'm trying to write a script to un-minimize an app that was previously minimized to dock.
Problem is, I can't find the relevant property. I've tried miniaturized
and collapsed
but neither the window nor the process seems to have those?
我使用(用于测试)的应用程序是Zipeg,这是一个免费的打包工具.
The app I use (for testing) is Zipeg, a free packing tool.
我也尝试单击该按钮以最小化该应用程序,但是在已经最小化的应用程序上运行以还原该应用程序时出现错误,这可能是因为没有可见的窗口.该脚本在下面.
I've also tried to click the button which happily MINIMIZES the app, but gives me an error when running on an already minimized app to restore it, probably because no window is visible. This script is below.
tell application "System Events"
tell process "Zipeg"
click button 1 of window 1
end tell
end tell
下面我用来列出属性的脚本.
The script I used to list properties is below.
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
如果未选中将窗口最小化为应用程序图标,则这将最小化单个窗口:
This unminimizes a single window if Minimize windows into application icon isn't checked:
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
将使第一个窗口最小化:
If all windows of an app are minimized, reopen
unminimizes the first one:
tell app "TextEdit"
reopen -- unminimizes the first minimized window or makes a new default window
activate -- makes the app frontmost
end tell
这篇关于使用Applescript最小化应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!