【发布时间】:2020-11-09 14:11:24
【问题描述】:
我有一个 AppleScript,它读取包含地址列表的文本文件,然后在 Outlook 中为每个地址创建一个带有主题的消息,并自动发送电子邮件。这是过去一年左右的工作,但它不再按预期工作。我不确定这是否是最近更新的 Outlook 或我的 Mac OS 造成的。现在发生的是,它只会发送txt文件第一行的地址。
结果窗口中的错误消息是:
error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value
在事件窗口中:
tell application "Microsoft Outlook"
read "/Users/******/OneDrive/address.txt" as «class utf8»
end tell
tell current application
read "/Users/******/OneDrive/address.txt" as «class utf8»
end tell
tell application "Microsoft Outlook"
set the clipboard to "abuse@*****"
make new outgoing message with properties {subject:"this is a test"}
make new recipient with properties {email address:{address:"abuse@****"}} at end of every to recipient of outgoing message id 465175
send outgoing message id 465175
set the clipboard to "postmaster@*****"
make new outgoing message with properties {subject:"this is a test"}
Result:
error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value
在回复窗口中:
tell application "Microsoft Outlook"
read "/Users/******/OneDrive/address.txt" as «class utf8»
--> error number -10004
end tell
tell current application
read "/Users/******/OneDrive/address.txt" as «class utf8»
--> "abuse@****
postmaster@****"
end tell
tell application "Microsoft Outlook"
set the clipboard to "abuse@*****"
make new outgoing message with properties {subject:"this is a test"}
--> outgoing message id 465175
make new recipient with properties {email address:{address:"abuse@****"}} at end of every to recipient of outgoing message id 465175
--> to recipient 1 of outgoing message id 465175
send outgoing message id 465175
set the clipboard to "postmaster@*****"
make new outgoing message with properties {subject:"this is a test"}
--> missing value
Result:
error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value
当我查看 Outlook 的 AppleScript 库时,我注意到我找不到收件人的参考。我还尝试了来自其他在线来源的代码,这些代码被报告为直接在代码中使用单个地址进行工作和测试,但我仍然收到类似的错误“缺失值”
我的 Outlook 版本为 16.39 (20071300) 我的 MacOS 是 10.15.5 版
这是脚本,为了隐私,我在 mac 上标出了用户名; 告诉应用程序“Microsoft Outlook”
set srcFile to ("/Users/******/OneDrive/address.txt") as text
set lns to paragraphs of (read srcFile as «class utf8»)
repeat with ln in lns
set the clipboard to ln
set theMessage to make new outgoing message with properties {subject:"this is a test"}
make new recipient with properties {email address:{address:ln}} at end of to recipients of theMessage
send theMessage
end repeat
说完
谁能帮忙?
【问题讨论】:
标签: macos outlook automation applescript office365