Force Quit a given application using applescript?

Is there an applescript term that I can use to Force-Quit a given application,
ie I would like it so when a script is run it Force-Quits say mail.app, not just normal quitting, but force-quitting it so it closes any open documents quickly. Is this possible?

tell application "Mail" to quit saving no

Will this at as a Force-Quit, what I am looking to do is compile a script that I will set iCal to run at like 3AM that will Force_quit my Mail.app, Safari and iChat, the reason is, often I leve these applications open on accident and if iChat gets a message it prevets iChat from closing, and then stops my entire restart process and I am left in the morning with open windows open asking me if i want to save them. I just want everything closed automaticly.

Well, you could always try it and see; that’s how I figured out that it works in Mail when unsaved messages being composed are left open. (Haven’t had the chance to try it in iChat with an unresponded-to invitation pending, but in Tiger, iChat can be quit with open chats without protesting.)

I thought if you could get system events to click on an item in the Dock with control-option and then keystroke an up arrow and then return, you could select “Force Quit” for any app that you specify. So far I can’t get it to work. Does anyone know how to click on an item in the dock as if you clicked it with the mouse? I commented out the lines that don’t work. This will activate QuarkXPress when I run the script so that much works at least.
Warning: if you try this and uncomment the key down lines, MAKE SURE you uncomment the key UP commands too. Otherwise, the keys stay pressed down even after the script it over!



tell application "System Events"
	tell process "Dock"
		--key down control
		--key down option
		click button "QuarkXPress"
		--key code 126  --up arrow
		--key code 36  --Return
		delay 2
		--key up control
		--key up option
	end tell
end tell
beep 1


Model: Mac G5
Operating System: Mac OS X (10.3.9)

Hi Corbin,

If you want the processes stopped without any dialogs, you could try this approach using the Unix Kill command.

set myProcesses to {"Mail", "Safari", "iChat"} -- The ones to quit.

tell application "System Events"
	repeat with myProcess in myProcesses
		set theID to (unix id of processes whose name is myProcess)
		try
			-- Should stop the application with no dialogs and no items saved.
			do shell script "kill -9 " & theID
		end try
	end repeat
end tell

Best wishes

John M

Couldn’t you just do something like:

do shell script {"killall Mail", "killall iChat", "killall Safari}

Seem like that’d be the simple way if lists work in shell scripts.