获取草稿的收件人(AppleScript、Mail.app)
我想使用 AppleScript 获取 Mail.app 草稿文件夹中草稿的收件人(“收件人”字段等)。似乎找不到正确的语法。
谢谢。
I want to get the recipients ("to" fields, etc) of a draft on my draft's folder of Mail.app, by using AppleScript. Can't seem to find the correct syntax to that.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实际上,与之前提出的 Cocoa 解决方案不同,纯 AppleScript 是可能的。以下是用于获取“TO”收件人字段的输入值的代码片段。
您提到您需要一个特定的草稿,对于此脚本,我假设您可以(例如)通过获取具有最高 ID 的草稿消息来获取最新草稿。这就是上面的脚本使用带有通用简单排序处理程序的反向命令所做的事情。
Actually it is possible with pure AppleScript unlike the Cocoa solution proposed earlier. Here's a snippet of the code used to get the input values of the "TO" recipients field.
You mentioned that you needed a specific draft, for this script I've assumed that you can (for instance) obtain the latest draft by taking the draft message with the highest ID. This is what the above script does using the reverse command with a generic simple sort handler.
草稿邮箱包含在消息查看器中。由于邮件尚未发送,因此您无法获取其“收件人”。但是,您可以获取包含收件人列表的消息源。诀窍是从该文本中提取收件人。
The drafts mailbox is contained by the message viewer. Since the messages have not been sent yet, you cannot get its "to recipients". However, you can get the message source that contains the list of recipients. The trick is to then extract the recipients from this text.
下面是在 Scripting Bridge (Cocoa) 中执行此操作的代码:
Here's code to do it, in Scripting Bridge (Cocoa):