[英]How to get Mail.app raw message in the Automator?
需要从OS X Mail.app获取原始消息内容,并将其传递到下一步操作。
不幸的是-测试了这一点-无效::(
我不想选择消息的“内容”,但希望将raw
内容(base64编码的内容)传递给下一个动作。
因此,可能需要在“获取选定的邮件”和“新建文档”之间进行一些applescript action
。
还不知道该怎么做...
“ New TextEdit doc”仅用于测试,实际的操作将是一个perl
脚本,它将从stdin
读取raw message content
。
尝试:
on run {input, parameters}
set theSource to {}
tell application "Mail"
repeat with aMessage in input
set end of theSource to aMessage's source & return
end repeat
end tell
return theSource as text
end run
这是一些在“获取选定的邮件”操作之后运行的AppleScript操作的代码。 它将被放置在动作中:“运行AppleScript”
-- This script accepts an input which is a list of message objects from Mail and returns their properties.
-- The properties returned are in the form of an AppleScript properties record.
on run {input, parameters}
tell application "Mail"
set output to {}
repeat with thisMessage in input
set output to output & (properties of thisMessage)
end repeat
end tell
return output
end run
我认为此脚本是进度,但其操作会返回AppleScript记录的列表。 您可能想要选择并选择AppleScript中想要的字段,然后将所有邮件消息作为文本返回以进行下一步操作,即您的Perl脚本能够解析纯文本,而不必处理AppleScript记录。
您可以使用上面的AppleScript来查看记录键和值,然后编写一个AppleScript实际在完成的工作流中使用,该工作流仅选择所需的字段。
-凯德尔
kaydell@yahoo.com
http://learnbymac.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.