Disregarding an application support when it's not installed

I want to add optional support for Growl and Firefox to a script I’m going to distribute, but so far if the user runs the script and doesn’t have those apps installed, they get a dialog box looking to find it.

Is there a way to add support for certain applications, but if the user doesn’t have that app NOT pull up the Where is “blah”? dialog box when the app runs? I’ve seen how to check if an app’s process is running or not, but even that requires the app be installed…

Hi,

I use this handler in one of my applications

check_Application_exists("com.Growl.GrowlHelperApp") --> returns boolean true or false

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

this works in both Leopard and Tiger,
for Leopard only this is sufficient


check_Application_exists("GrowlHelperApp")

on check_Application_exists(theApp)
	try
		get id of application theApp
		return true
	on error
		return false
	end try
end check_Application_exists

That seems to work nicely, however, I’m confused as to why that code successfully prevents the “Where is blah.app” dialog on launching the script, yet the following code doesn’t prevent it.


	tell application "System Events" to set growlIsRunning to (count of (every process whose name is "GrowlHelperApp")) > 0
	if growlIsRunning = true then
tell application "GrowlHelperApp" to ...
end if

The only difference I see is that your check happens with the Finder, and the one above with System Events…is that it?

my code doesn’t evoke the “Where is blah.app” dialog.
Unlike System Events, the Finder knows the property application file id

Gotcha. Thank you very much. That will help me a lot.

OK, so for Tiger do I need to use the plist files for all apps, or was that just the case for Growl? I tried using

check_Application_exists("Firefox")

and that didn’t seem to work…do I need to search for the plist file, or is there a different name than Firefox?

the bundle identifier is not always the same as the preference file
Especially Firefox doesn’t care about the “rules”, maybe because it’s still a Carbon app.

the bundle identifier of FireFox is org.mozilla.firefox

Thanks. This is great info.

How do I find out the bundle identifier for a particular app?

Nevermind - found it:

http://applescriptsourcebook.com/viewtopic.php?pid=60341

get bundle identifier of (info for (path to application "TextEdit"))

bundle identifier of (info for (choose file))

I was looking for a solution to this problem and seem to have hit a brick wall with the information in this topic. Here is the code that I am using:

set GrowlIsRunning to check_Application_exists("com.Growl.GrowlHelperApp")

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

if GrowlIsRunning is true then
	tell application "GrowlHelperApp"
		return "it exists"
	end tell
else
	return "no good"
end if

My objective is to have the code ignore the growl notifications if growl is not installed on the current machine.

I run into the Choose Application window. When I run it and when I try to compile the code. Please advise. Thank you!

~JL