我需要能够从当前消息线程中获取当前突出显示的消息。
IE
- 线程 1
- 留言 1
- 消息 2
- 消息 3 <- 突出显示的消息
- 消息 4
我努力了:
tell application "Mail"
set messages to selected messages of first message viewer
set msg to first item of messages
end tell
但这只是返回当前选定消息的线程。它也不包括线程中的任何传出消息。
我需要能够从当前消息线程中获取当前突出显示的消息。
IE
我努力了:
tell application "Mail"
set messages to selected messages of first message viewer
set msg to first item of messages
end tell
但这只是返回当前选定消息的线程。它也不包括线程中的任何传出消息。
您没有说明您使用的是哪个版本的 Mail 或 Mac OS X,但该脚本不能与 Mail 10.2 / OS 10.12.2 一起运行。错误是“邮件出错:无法将每条消息都设置为消息查看器 1 的选定消息”。
这种轻微的修改对我有用:
tell application "Mail"
set theMessages to selected messages of first message viewer
set theMessage to first item of theMessages
end tell
如果我针对您描述的消息结构运行它,那么它将 theMessage 设置为选择的任何一个。如果选择了多个,那么在我的测试中,顺序是预期的(从上到下),除非还选择了“线程 1”。在这种情况下,顺序可能会有所不同。