launch an application when it crashes with applescript

hi,
i have an application on a server that would quit/crash once in a while and i would like to have a script to relaunch it automatically but i can’t find an event to trigger the applescript to reopen.
thanks for the help,

i have something like this


on run
	tell application "Finder"
		open file "Macintosh HD:Applications:TextEdit"
	end tell
end run

on idle
	tell application "Finder"
		if not (process "Macintosh HD:Applications:TextEdit" exists) then
			open file "Macintosh HD:Applications:TextEdit"
		end if
	end tell
	return 50
end idle

it works to a degree… it’s annoying to have it open up all the time while you’re working on something else… any thoughts?
(i’m using textedit as an example)

Hi,

This might work:

on run
tell application “TextEdit” to activate
end run

on idle
tell application “Finder”
if not (process “TextEdit” exists) then
tell application “TextEdit” to launch
end if
end tell
return 10
end idle

If the application is a script app, then you need to use the launch and run combo. Like:

tell app “MyScriptAppName”
launch
run
end tell

This may not cover it all, so write back if no solution.

gl,

I played “Ghost Recon” alot on Gameranger. It has the option to “host” a game, where
your computer takes care of all the communications, but you are not there. The
problem I had was the same that you have. The application quits, and your not there
to restart it. So I wrote this. It might help you.