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?
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.
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.
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.