AppleScript: System Events – app i srunning

if appIsRunning("Safari") then
    beep -- or do something ;-)
end if

on appIsRunning(appName)
    tell application "System Events" to (name of processes) contains appName
end appIsRunning