Newbie Question -> Checking if an app is alive

Hi All,

How can I check if an application is alive without launching it again?

Thanks

Define ‘alive’, please.

Do you mean it’s listed in the process table (e.g. it has been launched), or do you mean actively processing data (e.g., it hasn’t hung/locked up, etc.).

If the former:

tell application "System Events"
   if (name of every application process) contains "Your App Name" then
      -- app is launched
   else
      --- it isn't
   end if
end tell

or a slightly simplified version:

tell application "System Events"
	set appLives to exists (application process "Your App Name")
end tell