How can I know that an application is already lauched.

From time to time my application quits.
I would like to find a way to activate it again.
thanks.

Hi,

This will give you the name of every application (including hidden ones).

tell application "System Events"
	set theApps to name of every process
end tell

If you only want the visible ones:

tell application "System Events"
	set theVisibleApps to name of every process whose visible is true
end tell

You’ll need to check if the list returned contains your applications name. If it’s not there you’ll need to tell it to activate.

something like:

set myApp to "Mail" -- your app name
tell application "System Events" to set theVisibleApps to name of every process whose visible is true
if theVisibleApps does not contain myApp then
	tell application myApp to launch
end if

It’s probably best to put this in an on idle handler in a stay open applescript app.

Best wishes

John M