Is there a script that can save documents and quit open applications?


Is there a script that can quit open applications (not background processses) after having saved their open documents ?? Thanks in advance.

Try the following:

property appsToKeep : {"Finder"}
-- shuts down all non-essential applications - you choose appsToKeep
--add appsToKeep to the property list above
set appList to list processes
repeat with i from 1 to count of appList
	set appName to item i of appList
	set appInfo to get process appName
	if not onlyBackground of appInfo then
		set skipIt to false
		repeat with j from 1 to count of appsToKeep
			if appName = (item j of appsToKeep) then
				set skipIt to true
				exit repeat
			end if
		end repeat
		if not skipIt and appName != (get current process) then
			tell application appName
			end tell
		end if
	end if
end repeat

This script requires the “Processes Dictionary” in your “Scripting Additiions” Folder.
Let me know if you need a copy and I can email you this “Freeware” osaxen

Hello Paul,

Thanks for your help. I would appreciate having the “Processes Dictionary”. Do you know where I could have more specific information on the use of PROPERTY ? How is it different from:

set appsToKeep to {"Finder"}

Thanks again for your help.

The list appsToKeep is a property of the script.
If you do not want to quit any specific application such as “Microsoft Excel” then modify the first line to

property appsToKeep : {"Finder","Microsoft Excel"} 

The following is a link to an AppleScript Language Guide and it does talk about much of AppleScrit’s Language including property.
I’ll email you a copy of the osaxen. Use Stuffit Expander to unstuff it.

Good Luck