Help with a simple script

Hello all,

I’m pretty sure someone here can help me with this, as it’s quiet simple. I did google around, but found several conflicting answers going back ten years. All I’m trying to do is this:

if ApplicationIsRunning("AccXES-Tools") then
	tell application "Finder"
		do shell script "killall AccXES-Tools"
	end tell
end if

I’ve had the tell part of it running on all my machines for like a year now, but it’s annoying to have the error message I get if the app itself isn’t running. So this morning I thought to make it conditional in some way. Is this the best approach? This will have to run on systems ranging from 10.4.11-10.6.8, and eventually Lion.

Oh, and from what I can tell, it has to be a killall, because on quit, the stupid app asks if you want to save changes. No matter what.

I appreciate the help. While I’m not totally new to Applescript, I am kind of lost in the woods at times.


-- illustrated with Safari; use your app name.
tell application "System Events"
	if name of processes contains "Safari" then
		do shell script "killall Safari"
	end if
end tell

Thanks Adam!