我正在使用OutlookforMac15.30(161251)
我有一个脚本可以将所有附件保存到文件夹中。它最近停止工作了,我正在试图找出原因。
旧的保存命令save theAttachment in file savePath
给出Microsoft Outlook got an error: An error has occurred.
我换了save theAttachment in POSIX file savePath
现在我得到了Microsoft Outlook got an error: Parameter error.
我检查过这条路,看上去很好。
有什么想法吗?
发布于 2016-12-19 13:38:19
我无法看到您的所有代码(假设有超过这两行),所以我无法用您的场景来测试它。
然而,我发现很多论坛上的人都有同样的问题。
看看来自这个论坛的这段代码
set saveToFolder to (choose folder with prompt "Choose the destination folder") as string
set prefix to the text returned of (display dialog "Enter the text to prefix the saved attachment names with" default answer "" buttons {"Cancel", "OK"} default button 2)
set ctr to 0
tell application "Microsoft Outlook"
set topFolder to mail folder "inbox" of on my computer
set srcFolder to mail folder "myfolder" of topFolder
set destFolder to folder "myFolder2" of topFolder
set selectedMessages to messages of srcFolder
repeat with msg in selectedMessages
set ctr to ctr + 1
set attFiles to attachments of msg
repeat with f in attFiles
set attName to (get the name of f)
log attName
set saveAsName to saveToFolder & prefix & ctr & attName
log saveAsName
save f in saveAsName
end repeat
move msg to destFolder
end repeat
end tell
display dialog "" & ctr & " messages were processed" buttons {"OK"} default button 1
return ctr发布于 2019-02-11 01:36:47
下面是一个工作示例,包括处理posix路径:
set saveToFolder to POSIX path of (choose folder with prompt "Choose the destination folder")
set ctr to 0
tell application "Microsoft Outlook"
set srcFolder to mail folder "SomeFolder" of on my computer
set selectedMessages to messages of srcFolder
repeat with msg in selectedMessages
set sentstamp to time sent of msg
set y to year of sentstamp
set m to month of sentstamp
set d to day of sentstamp
set rdate to y & "-" & m & "-" & d
set ctr to ctr + 1
set attFiles to attachments of msg
set actr to 0
repeat with f in attFiles
set attName to (get the name of f)
log attName
set saveAsName to saveToFolder & "mrp-" & rdate & "-" & actr & ".csv"
set actr to actr + 1
save f in POSIX file saveAsName
end repeat
end repeat
end tell
display dialog "" & ctr & " messages were processed" buttons {"OK"} default button 1
return ctrhttps://stackoverflow.com/questions/41223596
复制相似问题