Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

daneoni

macrumors G5
Original poster
Mar 24, 2006
12,019
1,923
I just watched the last WWDC Keynote and after demoing spaces, Steve clicks on an AppleScript icon in the Dock that quit all the open applications he was running at the time.

I NEED that. Any idea how to get this?
 
Just searched and can't seem to find anything related.
 
i too would be interested, i looked at the suggusted site but didnt see anything, maybe i mised it though.
 
Something like this:
Code:
set white_list to {"Finder"}

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
			tell application this_process
				quit
			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

This will not quit any applications that are "hidden".
You can change the variable "white_list" to suit your needs.
 
Click the following link:

applescript://com.apple.scripteditor/?action=new&script=tell%20application%20%22System%20Events%22% 20to%20set%20theApps%20to%20%28name%20of%20every%2 0process%20whose%20visible%20is%20true%20and%20nam e%20is%20not%20%22Finder%22%20and%20name%20is%20no t%20%28my%20name%20as%20text%29%29%0D%0Drepeat%20w ith%20theApp%20in%20theApps%0D%09tell%20applicatio n%20theApp%20to%20quit%0Dend%20repeat%0D

Once you click the link above, Script Editor on your machine will have the script in a window. Save it to ~/Library/Scripts as an application, giving it any name you want, like Quit All Apps. Then open /Applications/Applescript/Applescript Utility and check the box that is labeled Show Script Menu In Menu Bar and quit Applescript Utility.

Now any time you want to quit all apps except hidden, background, Finder, and Script Editor, then just choose the script from the Script Menu in the upper right on the menu bar.

If you want to "unhide" all hidden apps so they would get quitted also, you would add the line

tell application "System Events" to set the visible of every process to true

at the beginning of the script.
 
Click the following link:

applescript://com.apple.scripteditor/?action=new&script=tell%20application%20%22System%20Events%22% 20to%20set%20theApps%20to%20%28name%20of%20every%2 0process%20whose%20visible%20is%20true%20and%20nam e%20is%20not%20%22Finder%22%20and%20name%20is%20no t%20%28my%20name%20as%20text%29%29%0D%0Drepeat%20w ith%20theApp%20in%20theApps%0D%09tell%20applicatio n%20theApp%20to%20quit%0Dend%20repeat%0D

Once you click the link above, Script Editor on your machine will have the script in a window. Save it to ~/Library/Scripts as an application, giving it any name you want, like Quit All Apps. Then open /Applications/Applescript/Applescript Utility and check the box that is labeled Show Script Menu In Menu Bar and quit Applescript Utility.

Now any time you want to quit all apps except hidden, background, Finder, and Script Editor, then just choose the script from the Script Menu in the upper right on the menu bar.

If you want to "unhide" all hidden apps so they would get quitted also, you would add the line

tell application "System Events" to set the visible of every process to true

at the beginning of the script.

Tried this but it wont let me save and gives an error

Something like this:
Code:
set white_list to {"Finder"}

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
			tell application this_process
				quit
			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

This will not quit any applications that are "hidden".
You can change the variable "white_list" to suit your needs.

This seems to work BUT should i save it as an App or just a script. I saved it as an App in /Library/Scripts/

Thanx for all help thus far by the way
 
This seems to work BUT should i save it as an App or just a script. I saved it as an APp in /Library/Scripts/

Thanx for all help thus far by the way
If you save it as a script (not an app) in "Library>Scripts" you can access it from the script menu.
It you save it as an application you can run it by simply double clicking on it's icon.

So whatever is more convenient for you. :)
 
If you save it as a script (not an app) in "Library>Scripts" you can access it from the script menu.
It you save it as an application you can run it by simply double clicking on it's icon.

So whatever is more convenient for you. :)

Thanx. Do you happen to have one that hides/close all open apps' windows instead of quitting them?, this along with the above one would be life savers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.