On Mac OS X (10.6.4) is there a keyboard shortcut to close all other windows except the one with focus?
Not that I know of.
You can however hide all other applications with
You can create an applescript to close all but the frontmost window of the current application. In snow leopard, you can put it in an automator service and give it a keyboard shortcut. Alternatively, you can use Fastscripts to give it a shortcut.
Edit: I've added hiding other applications to the applescript.
Edit #2: OK, after testing I found the
repeat while window 2 exists actually didn't stop looping, causing nasty autoclose behaviour when opening new windows. The new code should be more robust.
with timeout of 2 seconds try tell application "System Events" set app_name to name of the first process whose frontmost is true set visible of (every process) to false -- hide everything end tell tell application app_name activate -- show frontmost application repeat with aWindow in (get every window) if index of aWindow > 1 then close aWindow end repeat end tell on error error_message number error_number display alert ("Something went wrong:") ¬ message error_message ¬ & (" Error number ") & error_number & "." end try end timeout