Quitting except few app

I am trying to make a condition that unless the current app is Better touch tool or finder how can I do that when left clicked red button

You want to quit any app but BetterTouchTool and Finder by clicking the Red button if I get you right.
Assign the following script to a click on the desired button:

tell application "System Events"
	set currentApp to name of first application process whose frontmost is true
end tell

if currentApp is "BetterTouchTool" then
	tell application "System Events"
		keystroke "w" using command down
	end tell
else if currentApp is "Finder" then
	tell application "System Events"
		keystroke "w" using command down
	end tell
else
	tell application currentApp
		quit
	end tell
end if

you get it right but where do I put the code

found it

1 Like