我尝试使用applescript保存附件,我的脚本在文件较小时(例如109字节)运行良好,但在附件太大时保存空文件(304KB)。我正在研究macOS High Sierra并且不知道如何修复它,任何人都有任何想法?
我的代理人:
using terms from application "Mail"
on perform mail action with messages theMessages
set myPath to "Macintosh HD:Users:MY_USER:Downloads:"
tell application "Mail"
repeat with eachMessage in theMessages
repeat with theAttachment in eachMessage's mail attachments
set originalName to name of theAttachment
set savePath to myPath & originalName
try
save theAttachment in savePath
end try
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
由于
答案 0 :(得分:1)
如https://apple.stackexchange.com/a/322724/156892中所述,更改:
save theAttachment in savePath
收件人:
save theAttachment in file savePath
此外,如果您这样设置myPath,则会更加健壮:
set myPath to (path to downloads folder as text)