On Quit

This results in an AppleScript error -2706

Then is DOES quit, can anyone explain why/how to fix it? I want to clean up some temp files my ASS app produced before quitting, so I do this…

on should quit theObject
	do shell script "/bin/rm /private/tmp/*txt > /dev/null 2>&1 &" user name adminName password adminPass with administrator privileges
	tell me
		quit
	end tell
end should quit

Note that if I either remove the “Tell me quit” or don’t backgroud the preceding “do shell script,” the Applicaition won’t quit. I know I can trap the error, but I’m wondering if I’m doing this wrong…

A “should” handler should return true or false: true if it should do the action, false if not.

In your case, the should quit should end with a “return true” statement instead of the tell me to quit block.

A should handler is trying to find out whether or not to continue the action; a will handler means the action will happen no matter what. You might be better off moving your cleanup code to the will quit handler, because that one guarantees the app will quit while the should quit handler doesn’t.