我在网站上复制了一些脚本,结果是Outlook创建了新的转发邮件,但收件人是空白的。尝试了多种形式,但总是空白的收件人。这是一个我只会为我手动选择的消息运行的脚本,所以我不能在应用程序中使用简单的转发规则。 有什么想法吗?
tell application "Microsoft Outlook"
repeat with eachSelectedMessage in selectedMessages
set theForwardedMessage to forward eachSelectedMessage with opening window
make new recipient at theForwardedMessage with properties {email address:{address:"recipient@somewhere.com", name:"Lumpkin Skinbark"}}
send theForwardedMessage
end repeat
end tell
答案 0 :(得分:0)
新信息:事实证明收件人正确填充并放入我的发件箱,但未发送。此外,会弹出一个新窗口,其中包含相同的转发邮件和一个空白收件人。我看到的那个新窗口让我相信收件人没有填充。
我现在的解决方法是定期点击Outlook中的发送/接收按钮发送位于发件箱中的消息(我不知道为什么它们不会像其他所有内容一样自动发送)。然后我补充道:
关闭窗口1
关闭打开的窗口 - 不知道为什么创建它并且不想要它,但也可以关闭它并继续前进。
所以我确实有它工作,但它并不优雅。
答案 1 :(得分:0)
我终于想出了如何完成这项工作:不要打开转发的电子邮件窗口,直到您设置了电子邮件属性,特别是收件人。
这是我的测试脚本:
set newSubjectStr to "TEST -- DON'T OPEN at first."
set recipientEmail to "somebody@InvalidDomainName.com"
tell application "Microsoft Outlook"
set selMsg to current messages
set oMsg to item 1 of selMsg
set subjectStr to subject of oMsg
set oFwdMsg to ¬
forward oMsg without opening window ## This is KEY. Don't Open Window
make new recipient at oFwdMsg ¬
with properties {email address:{address:recipientEmail}}
set subject of oFwdMsg to newSubjectStr
--- NOW OPEN FWD EMAIL WINDOW ---
open oFwdMsg
end tell
--- SEND NOW IF NO MORE CHANGES ---
-- Works fine if I manually send, or use keyboard shortcut --
-- Send and Close Window ---
delay 0.2
tell application "Microsoft Outlook" to activate
tell application "System Events"
key code 36 using {command down} -- CMD-RETURN
end tell
--- BELOW SEND BY SCRIPT LEAVES MSG IN OUTBOX ---
--send oFwdMsg
--close window 1
--sync folder "Outbox"
主持人注意:有没有办法让AppleScript获得语法高亮?