You are not logged in.
There are several methods to check it. We will post here one of them:
tell application "System Events" to (name of processes) contains "Safari"
This sentence will return "true" or "false". That's all!
If you don't know the exact name of the application (eg, it could be "InDesign" or "InDesign 2.0.2" or "InDesign├?┬«" or...), you can ask instead for its creator code:
tell application "System Events" to (creator type of processes) contains "InDn"
And... How do you know the creator type of a particular application? Just select its icon in the Finder and run this code:
tell application "Finder" to creator type of (selection as alias)