我通过电子邮件自动收到很多电子名片,我想将它们自动导入到我的联系人中。
我编写了一个 AppleScript,它将打开 vcard 文件并导入联系人。但首先我需要下载文件,对吗?
但是如何使用 AppleScript 和邮件中的规则从电子邮件下载附件文件?
谢谢。
干杯, 克里斯
最佳答案
下面的脚本将所选电子邮件中附加的文件保存到目标文件夹中。然后您可以使用这些文件将它们添加到地址簿中。
set Dest to ((path to desktop folder) as string) & "FMail:" -- the folder to save attached files
tell application "Mail"
activate
set ListMessage to selection -- take all emails selected
repeat with aMessage in ListMessage -- loop through each message
set AList to every mail attachment of aMessage
repeat with aFile in AList --loop through each files attached to an email
if (downloaded of aFile) then -- check if file is already downloaded
set Filepath to Dest & (name of aFile)
save aFile in Filepath as native format
end if
end repeat -- next file
end repeat -- next message
end tell
我添加了很多评论以使其清楚。然后您就可以根据您的需要进行调整。
关于email - 如何通过applescript和邮件规则从邮件下载附件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39882312/