detect if application is running

how would you check if an app is running (even if no windows for it may be open)??

tell application “System Events”
–set proc_list to displayed name of every application process
set proc_list to name of every application process
end tell

note: for long names “displayed name” will return the name displayed by the finder.

tell application "System Events"
    if exists process "Whatever" then
        beep
    else
        beep 2
    end if
end tell

I have been looking for something similar that could be continously looking until the application is closed and then give a command. I have found one way, but I am wanting to know if there is something that takes less resources while it loops.


repeat
	delay 30 --Ideally more often than this, but remaining low on resource usage	tell application "System Events"
		if not (exists process "Whatever") then
			activate application "Whatever Else"
			exit repeat
		else
			
		end if
	end tell
end repeat