• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining the Default Mail App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining the Default Mail App


  • Subject: Re: Determining the Default Mail App
  • From: kai <email@hidden>
  • Date: Thu, 9 Feb 2006 00:01:24 +0000


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
  • Follow-Ups:
    • Re: Determining the Default Mail App
      • From: Serge Ségu <email@hidden>
    • Re: Determining the Default Mail App
      • From: Todd Geist <email@hidden>
    • Re: Determining the Default Mail App
      • From: Gnarlodious <email@hidden>
    • Re: Determining the Default Mail App
      • From: Adam Bell <email@hidden>
References: 
 >Re: Determining the Default Mail App (From: Matt Deatherage <email@hidden>)

  • Prev by Date: [AS] saving as AppleWorks 5
  • Next by Date: Re: Determining the Default Mail App
  • Previous by thread: Re: Determining the Default Mail App
  • Next by thread: Re: Determining the Default Mail App
  • Index(es):
    • Date
    • Thread