如何获得使用applescript的默认邮件客户端?

问题描述:

任何人都可以请告诉我,我如何获得使用苹果脚本的默认邮件客户端?如何获得使用applescript的默认邮件客户端?

我发现这个代码here的一部分,怎么跑这对雪豹一些代码示例( 10.6.4),它对我有用。

on run 
    set mailClient to getDefaultMailClient() -- store application id 
    tell application id mailClient to activate -- tell mail client to do something 
end run 

-- Grab id of default mail client 
on getDefaultMailClient() 
    set prefPath to (path to preferences as text) & "com.apple.LaunchServices.plist" 
    tell application "System Events" 
     try 
      value of property list item "LSHandlerRoleAll" of ¬ 
       (first property list item of property list item "LSHandlers" of ¬ 
       property list file prefPath whose value of property list items ¬ 
       contains "mailto") 
      on error 
       "com.apple.mail" 
     end try 
    end tell 
end getDefaultMailClient 
+0

似乎并没有对高塞拉利昂工作。因人而异。 – dashard 2018-03-09 12:59:02

一直存在于这个toppic的讨论在macscripter-forum 那里,你还找了用于测试的默认邮件客户端

另一种选择:VERSIONER_PERL_PREFER_32_BIT=1 perl -MMac::InternetConfig -le 'print +(GetICHelper "mailto")[1]'