Is there an AppleScript for expanding minimized apps?

I have a script that will minimize running apps using a Keyboard 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?

Generate Command+m ? Or Command+h?

But then again I suspect there is no universal interaction with apps. (I found this with moving app windows to and from my second screen.)

No here is the script that works:

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

Be sure to only run it after you’ve saved and given the script a file name, otherwise you’ll get an error message.

1 Like