Is there a way to save a list of all running apps?

is ther a way to save a list of all running apps?
and then shut them all down at the same time

set all_apps to all running apps
tell app “” & all_apps & “”
end tell


This was taken from a recent thread on this BBS:

tell application "Finder"
	get name of every application process
end tell


Whoops! I overlooked the “quit” requirement. Stay tuned…

I don’t think you can shut them down with a single command but you can loop through them. This script (while certainly not perfect) can be saved as an application and run to quit open apps:

set my_path to (path to me as string)
--add other apps you want to keep open here:
set protected_apps to {my_path, "loginwindow", "Dock", "SystemUIServer", "Finder", "System Events"}
tell application "System Events" to set all_apps to file of (processes)
repeat with this_app in all_apps
    set this_app to this_app as string
    set kill_app to true
    repeat with i from 1 to (count of protected_apps)
        if this_app contains (item i of protected_apps) then
            set kill_app to false
            exit repeat
        end if
    end repeat
    if kill_app = true then
            tell application this_app to quit
        end try
    end if
end repeat


what does

path to me