Re: Determining the Default Mail App
Re: Determining the Default Mail App
- Subject: Re: Determining the Default Mail App
- From: Gnarlodious <email@hidden>
- Date: Wed, 08 Feb 2006 21:54:04 -0700
- Thread-topic: Determining the Default Mail App
Works for me on 10.4.4, very good work kai! Even returns the app's name with
the proper case letters.
-- Gnarlie
Entity kai spoke thus:
>
> On 8 Feb 2006, at 22:58, Matt Deatherage wrote:
>> Since no one else has said this, I'll chime in: this is the best
>> approach currently available, even if it needs refinement to fix
>> errors.
> I've been playing with some variations - although, in view of the
> inconsistent results so far, I'm still unsure about how they might
> fare on different machines. Any feedback, particularly from those for
> whom the previous effort failed (or for whom these versions now
> fail), would be welcome.
> --------------------
> on defaultEmailApp()
> set p to POSIX path of (path to preferences) &
> "com.apple.LaunchServices.plist"
> tell application "System Events" to tell property list item
> "LSHandlerRoleAll" of (property list item 1 ¬
> of property list item "LSHandlers" of property list file p whose
> value contains "mailto") to if exists then
> set v to value
> tell application "Finder" to set {name:n, name extension:e} to
> application file id v
> tell (count e) + 1 to return n's text 1 thru -(1 mod it + it)
> end if
> "Mail"
> end defaultEmailApp
> defaultEmailApp()
> --> "Mail" (OMM)
> --------------------
> The browser version is very similar:
> --------------------
> on defaultBrowser()
> set p to POSIX path of (path to preferences) &
> "com.apple.LaunchServices.plist"
> tell application "System Events" to tell property list item
> "LSHandlerRoleAll" of (property list item 1 ¬
> of property list item "LSHandlers" of property list file p whose
> value contains "http") to if exists then
> set v to value
> tell application "Finder" to set {name:n, name extension:e} to
> application file id v
> tell (count e) + 1 to return n's text 1 thru -(1 mod it + it)
> end if
> "Safari"
> end defaultBrowser
> defaultBrowser()
> --> "Safari" (OMM)
> --------------------
> ---
> kai
> _______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden