在Lion中保存来自AppleScript的邮件附件

时间:2011-10-11 06:55:16

标签: applescript osx-lion

似乎在Lion下打破了使用applescript保存邮件附件的方法。假设'theAttachment'已经是正确的对象,包含例如附上jpg,这就是我所做的:

set strPath to (path to pictures folder) as string
save theAttachment in strPath -- leads to the error: "„Mail“ got an error: error in  AppleEvent-Routine." number -10000

save theAttachment in strPath as "test" -- leads to \"test\" can't convert into typ constant" number -1700 from "test" to constant

set fileName to strFileName as alias
save theAttachment in strPath as fileName -- error "The file „Foto-121121.jpg“ wasn't found." number -43 from "Foto-121121.jpg"

而且也无法通过触摸创建文件:

set thefullpath to POSIX path of strPath & fileName
do shell script "touch \"" & thefullpath & "\"" -- error "The file „Foto-121121.jpg“ wasn't found." number -43 from "Foto-121121.jpg"

谷歌发现的几个消息来源说,上面提到的方法在Snow Leopard下运行良好,但在Lion中却没有。有没有解决方法?

备注:我在这里翻译了来自德语的错误消息,但错误编号仍然相同。

1 个答案:

答案 0 :(得分:1)

Automator怎么样? Get Attachments from Mail Messages行动可行。