Is an application running?

mrivorykeys

Registered
I am a fairly low-level programmer (self-taught), so please excuse any silly questions. I'm creating an applescript which will do some things if a certain program (Mail) is closed, and other things if it is open. Is there an easy way to determine if an application is running in Applescript or terminal?

Thanks!
 
'Is there an easy way to determine if an application is running in Applescript or terminal?' - in AppleScript ...

tell application "System Events" to set tProcesses to name of processes

if (tProcesses contains "Mail") then
say "Mail is currently launched"
else
say "Mail is not currently launched"
end if

... or ...

tell application "System Events" to if ((name of processes) contains "Mail") then
say "Mail is currently launched"
else
say "Mail is not currently launched"
end if

-----

AppleScript is not 'low level' programming.
 
Back
Top