Menage a "on error" event

Hi all

AppleScript is good to menage other application, but when a script can’t find the application, give a window for choosing the right app.
So, I need a event to prevent this window.

For example

try
	tell application "Numbers.app"
		activate
	end tell
on error
	open location "http://apple.com"
end try

If I have NOT Numbers on my Mac, AS give me the Window “Where is Numbers.app?” and if I clic “Cancel”, AS give me an error, and open the location apple.com
This is not what I want.

I need a way to make the AS to search the application (not only Numbers, of course, :rolleyes:) and if it does not find it goes to apple.com directly.
Is it possibile?

Tnx in advance

Model: iMac 24
AppleScript: 2.2
Browser: Camino 1.6.1
Operating System: Mac OS X (10.5)

Hi Matteo,

try this, you have to check the bundle identifier:


if not check_Application_exists("com.apple.iWork.Numbers") then open location "http://apple.com"

on check_Application_exists(theApp)
	try
		tell application "Finder" to application file id theApp
		return true
	on error
		return false
	end try
end check_Application_exists

Hello (Again) Stefank

Uhm, This seems not to be easy. Let me undestand: how can I find every bundle identifier? My example talk about Numbers, but of course I need BI for every Mac applications (or maybe for the most, like Firefox, Photoshop, Illustrator, C4D, Office, Maya…)

And one more thing (I like to talk like Steve): this bundle identifier is not the file that I can find in myuser/Lybrary/Preferences, right?
(Yes, I know, I seem to be confused…)

in the most cases, the bundle identifier is the name of the preference file without the plist extension.
You can detect the bundle identifier with


display dialog (get bundle identifier of (info for (choose file)))