1
On Mac OS X (10.6.4) is there a keyboard shortcut to close all other windows except the one with focus?
1
On Mac OS X (10.6.4) is there a keyboard shortcut to close all other windows except the one with focus?
4
You can however hide all other applications with Option
+Command
+H
.
3
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
Does ⌥⌘H work differently on 10.6? On earlier releases it only hides other applications (if the current application has multiple windows open, they will all remain visible). – Chris Johnsen – 2010-06-20T20:36:29.990
@Chris: You are correct, all other applications. – Josh K – 2010-06-20T22:41:51.527