Make emails in Entourage - compatible with non Entourage users

I am using the following code in my applescript studio project to make an email in Entourage. I have working code for Apple Mail which does the same thing, but I want to allow people who have Entourage to use that too (if they love bloat then that’s their decision :stuck_out_tongue: ). The only problem is that people who don’t have Entourage installed used to get a message asking them “Where is Entourage.app” whenever they launched the application, even though the Entourage code doesn’t get called at launch.

To get around this, I made the name of the application a variable as you can see below. This worked, and it no longer asks where Entourage is if it isn’t installed.


set entourage to "Microsoft Entourage"
				tell application entourage
					activate
					make new outgoing message with properties {subject:filename, recipient:"adsf@jkl.com", content:"Output from software", attachment:entourage_attach_path}
				end tell

Now I have a related problem. The above code does not compile unless you wrap the tell block in a “using terms from application ‘Mail’” block. If you do, it makes Entourage launch but it does not make a message, it just throws up an error with some weird code in it.

So, my question: How can I include working code for Entourage users, but which does not bug users who do not have Entourage installed? This code needs to be as backwards compatible as possible, supporting a minimum of 10.4+

Also, if anyone has a snippet for getting the default mail client (yes I did search first but didn’t find anything) i’d be grateful for that too.

Thanks for your help,

Joe

In Mac OS X 10.5 Leopard you can find out about the default eMail client by parsing the following preferences file:

~/Library/Preferences/com.apple.LaunchServices.plist

The important key is ‘LSHandlerURLScheme = mailto;’ where ‘LSHandlerRoleAll’ indicates the current default eMail client, e.g. ‘com.apple.mail’ for Apple Mail.

Maybe you can use the System Events library to extract this info.

HTH.