【发布时间】:2013-11-27 01:00:59
【问题描述】:
谁能告诉我,如何使用 applescript 获取默认邮件客户端?
【问题讨论】:
标签: email client applescript
谁能告诉我,如何使用 applescript 获取默认邮件客户端?
【问题讨论】:
标签: email client applescript
我找到了这段代码的一部分 here,在 Snow Leopard (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
【讨论】:
另一个选项:VERSIONER_PERL_PREFER_32_BIT=1 perl -MMac::InternetConfig -le 'print +(GetICHelper "mailto")[1]'
【讨论】:
macscripter-forum 已经讨论过这个话题 在那里你还可以找到一些关于如何测试默认邮件客户端的代码示例
【讨论】: