[英]How to get Mail.app raw message in the Automator?
Need to get the raw message content from the OS X Mail.app a pass it to the next action. 需要从OS X Mail.app获取原始消息内容,并将其传递到下一步操作。
Unfortunately - tested this - and doesn't works: :( 不幸的是-测试了这一点-无效::(
I don't want select the "content" of the message, but want pass the raw
content (what is base64 encoded) to the next action. 我不想选择消息的“内容”,但希望将
raw
内容(base64编码的内容)传递给下一个动作。
So, probably will need some applescript action
betwwen the "Get Selected Mail Messages" and "New document". 因此,可能需要在“获取选定的邮件”和“新建文档”之间进行一些applescript
action
。
Haven't idea how to do this... 还不知道该怎么做...
The "New TextEdit doc" is only for tests, the real action will be an perl
script, what will read the raw message content
from the stdin
. “ New TextEdit doc”仅用于测试,实际的操作将是一个
perl
脚本,它将从stdin
读取raw message content
。
Try: 尝试:
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
Here is some code for an AppleScript action to be run after the action "Get Selected Mail Messages". 这是一些在“获取选定的邮件”操作之后运行的AppleScript操作的代码。 It is to be placed within an action: "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
This script is progress I think, but its action returns a list of AppleScript records. 我认为此脚本是进度,但其操作会返回AppleScript记录的列表。 You would want to pick and choose which fields that you wanted in the AppleScript and return all of the Mail messages as text for the next action, your Perl script to be able to parse plain text and not have to deal with AppleScript records.
您可能想要选择并选择AppleScript中想要的字段,然后将所有邮件消息作为文本返回以进行下一步操作,即您的Perl脚本能够解析纯文本,而不必处理AppleScript记录。
You can use the AppleScript above to peek at the record keys and values and then write a AppleScript to actually be used in your finished workflow which selects just the fields that you want. 您可以使用上面的AppleScript来查看记录键和值,然后编写一个AppleScript实际在完成的工作流中使用,该工作流仅选择所需的字段。
-- Kaydell -凯德尔
kaydell@yahoo.com kaydell@yahoo.com
http://learnbymac.com http://learnbymac.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.