![](/img/trans.png)
[英]Using AppleScript to send mail attachment through default email client
[英]How do I get the default mail client using applescript?
谁能告诉我,如何使用applescript获取默认的邮件客户端?
我在这里找到了部分代码,并在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论坛中对此主题进行了讨论,您还找到了一些有关如何测试默认邮件客户端的代码示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.