Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Minimize all windows in all apps via AppleScript System
A friend of mine asked how to minimize all windows in all open applications. This is what I came up with. The script only works if 'Enable access for assistive devices' is checked in the Universal Access System Preferences panel.
tell application "System Events"
  set theButtons to {}
  
  repeat with theApplication in application processes
    repeat with theWindow in windows of theApplication
      repeat with theButton in buttons of theWindow
        if ((description of theButton) is "minimize button") then
          set theButtons to theButtons & {theButton}
        end if
      end repeat
    end repeat
  end repeat
  
  repeat with theButton in theButtons
    click theButton
  end repeat
  
  --do it twice because it usually misses one the first time
  repeat with theButton in theButtons
    click theButton
  end repeat
end tell
[robg adds: On my desktop Mac, this script didn't seem to work at all -- it just sent CPU utilization to near maximum and sat there. (It worked fine on my PowerBook.) Investigating further, I figured out that when jEdit (a text editor written in Java) was running, then the script would hang. When I quit jEdit, the script worked as described. I'm not sure if this is a general problem with Java apps, or something specific to jEdit. Unfortunately, there's no "expand all minimized windows" alternative, though option-clicking on a window in the Dock should expand all of that application's other docked windows.]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[18,569 views]  

Minimize all windows in all apps via AppleScript | 6 comments | Create New Account
Click here to return to the 'Minimize all windows in all apps via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Minimize all windows in all apps via AppleScript
Authored by: phanofwclark on Mar 06, '06 07:22:25AM

Isn't there a way to do this where you just click the minimize button while holding a modifier key (not on a mac at the moment so i can't test this). I think its either option or apple.



[ Reply to This | # ]
Minimize all windows in all apps via AppleScript
Authored by: DavidRavenMoon on Mar 06, '06 08:57:05AM

Option-clicking the minimize button will minimize all open windows in a single application, but not all open applications.

I can't seem to make option-clicking the minimized window in the dock maximize them all. It doesn't do anything.

---
G4/Digital Audio/1GHz, 1 GB, Mac OS X 10.4.5
www.david-schwab.com
www.imanicoppola.net



[ Reply to This | # ]
Minimize all windows in all apps via AppleScript
Authored by: perihelion on Mar 06, '06 12:13:10PM

Command+option+h will hide all other windows ... not exactly the same. Butler can "unhide" all applications with the "show all applications command" (which I've set to command+control+option h). This is great for when I want to focus on one single thing and thet toggle everythig back again.

---
Information is the echo of the soul.



[ Reply to This | # ]
Minimize all windows in all apps via AppleScript
Authored by: baltwo on Mar 06, '06 01:43:56PM

AFAIK, that's what F9 does—it's an Expose option.



[ Reply to This | # ]
Minimize all windows in all apps via AppleScript
Authored by: dashard on Mar 06, '06 03:54:57PM

If you want to try it out but don't want to manually reopen all of your windows, keep the Terminal open in the background and simply type: killall Dock. Hit return or enter and your windows will magically expand when the Dock goes down.

Sometimes it's good to refresh the Dock.app anyway.

[ Reply to This | # ]

Minimize all windows in all apps via AppleScript
Authored by: ever on Mar 06, '06 08:22:42PM
I wrote a similar script that hides the windows of an application underneath the current window. It works quickly enough and doesn't hog dock space.
set front_app to path to frontmost application as Unicode text
tell application front_app
	try
		set y to the bounds of the front window
		repeat with x in windows
			set bounds of x to y
		end repeat
	end try
end tell


[ Reply to This | # ]