我如何使用AppleScript得到默认邮件客户端? [英] How do I get the default mail client using applescript?
本文介绍了我如何使用AppleScript得到默认邮件客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我,我该如何使用AppleScript得到默认邮件客户端?
Can anyone please tell me, how do I get the default mail client using applescript?
推荐答案
我发现这个code的这里,运行它雪豹(10.6.4),它为我工作。
I found part of this code here, ran it on Snow Leopard (10.6.4), and it worked for me.
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
这篇关于我如何使用AppleScript得到默认邮件客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文