Jump to content

Sparkly

Member
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Sparkly

  1. Hello All

    I am from those people who open so many windows apps and tabs, but at a certain point I feel overwhelmed and need for focus . So, I found this script and I modified the names of the apps that need to be persistent 

    tell application "System Events" to set the visible of every process to true
    set white_list to {"Finder","Todoist","Alfred 3","Snip","TextExpander","Alfred Preferences","ExpressVPN","Google Chrome"}
    
    try
    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
    		if this_process is not in the frontmost then
    			tell application this_process
                		quit
            		end tell
    		end if	   
    	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

    However, the frontmost app still get closed. In addition, I want to minimize all apps in the white_list except if it is the frontmost, any ideas?

     

    Thank you

×
×
  • Create New...