Jump to content

Force Quit All Apps Except App with Focused Window

Recommended Posts

Often I have so many apps running and want to simplify without restart.  I'd like to keep the focused app open if possible, most times this is Chrome.


I searched extensively online and found the below applescript.  I have been trying to tweak it but am unable to reach success.  I appreciate the support of this community and would be very thankful for any help.



tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}

tell application "Finder"
    set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
    set this_process to item i of the process_list
    if this_process is not in white_list then
        tell application this_process
        end tell
    end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
Edited by jloveblaze
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...