Find out if an application is minimized in the dock

How can a script determine if an application is minimized on the dock? And if it is, how do you un-minimize it?

Hi,

try this


tell application "System Events"
	tell process "iChat"
		if visible is false then set visible to true
	end tell
end tell

That doesn’t seem to work (with Evernote, which is the app I’m using)

of course you have to replace “iChat” with the process name of your app

I did that - of course! But it doesn’t work.

You don’t minimize an application. You minimize a window of an application. As StefanK pointed out you hide or show an application by setting its visible property.

So you need to target a window of an application. I don’t have Evernote so I’ll use Safari as an example. Open a Safari window and then minimize it. Then run this script and look at the properties…

tell application "Safari"
	properties of window 1
end tell

You can see the window is minimized by its properties…

{document:document “MacScripter / Post a reply” of application “Safari”, closeable:true, zoomed:true, class:window, index:1, visible:false, name:“MacScripter / Post a reply”, modal:false, miniaturizable:true, titled:true, miniaturized:true, floating:false, id:549, resizable:true, bounds:{12, 22, 1177, 800}, current tab:tab 2 of window id 549 of application “Safari”, zoomable:true}

So you can use a script like this to un-miniatureize a window…

tell application "Safari"
	tell window 1
		if miniaturized then set miniaturized to false
	end tell
end tell

Hank, thanks. It works!!