Is there an opposite to minimized apps?

I have a script that will minimize running apps using a shortcut.

tell application "Finder" to activate

tell application "System Events"
	tell application process "Finder"
		tell menu bar 1
			click menu item "Hide Others" of menu of menu bar item "Finder"
			click menu item "Minimize All" of menu of menu bar item "Window"
		end tell
	end tell
end tell

Is there a script that will do the opposite? Expand the minimized apps from their dock icons?

How about…

tell application "System Events"
	set visible of application process "Finder" to true
end tell

This script didn’t work. Nothing happened.

This script opened finder windows. I’m not sure if the windows were even minimized. It probably just opened new finder windows. It didn’t touch the other minimized applications.

Conclusion, both scripts didn’t work. Regardless, thank you for attempting to find a solution.

Please try this to unhide all hidden apps

tell application "System Events" to set allNames to name of processes whose background only is false and visible is false
repeat with aName in allNames
	reopen application aName
end repeat

and to maximize the Finder windows Fredrik71’s snippet is supposed to work which can be reduced to

tell application "Finder" to set collapsed of windows to false

An alternative to unhide hidden applications is to ask NSRunningApplication to do it

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions

tell application "System Events" to set allPids to unix id of processes whose background only is false and visible is false
repeat with pid in allPids
	set theApplication to (current application's NSRunningApplication's runningApplicationWithProcessIdentifier:pid)
	if theApplication is not missing value then
		theApplication's unhide()
	end if
end repeat

Please note that windows are minimized but applications are hidden which are two different things.

This script worked once but after that I started getting the error message below:

CleanShot 2024-02-11 at 15.13.13

I’m not sure of the reason behind it.

My snippet cannot cause the problem because it doesn’t contain properties,

I encountered the same issue on my Sonoma computer when I ran Stefan’s script in Script Editor and then tried to save it. Compiling the script did not allow me to save it. A simple workaround was to save the script in Script Editor before running it. From that point on, I could run, edit, and save the script without issue. This was not an issue with Script Debugger.


Thanks for the clarification. I’m always using Script Debugger.

I think you just have to create another script line?

click menu item "Show All" of menu of menu bar item "Finder"

My script now doesn’t work.