This code does not work for apps that do not exist because it prompts the user to look for “FooApp” (and I don’t want to interact with the user):
get exists application "FooApp"
This code only works for apps whose process name matches its application name, which covers most but not all applications:
tell application "System Events"
get exists application process "FooApp"
end tell
(For example on my machine “OmniGraffle Professional” is a process name but the corresponding application name is “OmniGraffle Professional 4”.)
Notice that your 2 scripts do different things. The first one checks if it is on the computer. The second one checks if it is currently running. So here’s how to do the first thing.
And note that as you point out some applications have a variety of names. In those cases you can use the bundle id of the app instead of it’s name. Here’s how to get the id of Safari and use it…
And if you wanted to see if it is running, like in your second script, you could do this…