【发布时间】:2015-06-30 06:43:45
【问题描述】:
其实我的问题和this one 是一样的,而且答案已经让我进步了很多。 (总结:我希望我的 python 脚本在每封带有特定主题的传入电子邮件上运行,并从内容中提取数据。)
无论如何,我是 AppleScript 的新手,找不到将触发电子邮件的内容作为参数提供给我的 python 脚本的解决方案。
实际上我只需要传递电子邮件的html内容。
谁能指出我正确的方向或给黑暗带来一些光明?非常感谢。
我的 AppleScript 目前看起来像这样,尽管我的脚本现在应该打印电子邮件内容,但什么也没有发生:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
set theContent to source of eachMessage
do shell script "python completePathToPyScript.py" & theContent
end repeat
end tell
end perform mail action with messages
end using terms from
然后我的 python 脚本执行以下测试:
import sys
email_data = str(sys.argv[1])
print email_data
或者我接管数据的方式不正确?
【问题讨论】:
-
你试过的代码在哪里?
标签: python macos email applescript