Outlook v15的Applescript-收件人不会填充
我在网站上复制了一些脚本,结果是Outlook创建了一个新的转发邮件,但收件人为空。尝试过多种形式,但总是空白收件人。这是一个脚本,我只会为我手动选择的邮件运行,所以我不能在应用程序中使用简单的转发规则。 有什么想法吗Outlook v15的Applescript-收件人不会填充,outlook,applescript,Outlook,Applescript,我在网站上复制了一些脚本,结果是Outlook创建了一个新的转发邮件,但收件人为空。尝试过多种形式,但总是空白收件人。这是一个脚本,我只会为我手动选择的邮件运行,所以我不能在应用程序中使用简单的转发规则。 有什么想法吗 tell application "Microsoft Outlook" repeat with eachSelectedMessage in selectedMessages set theForwardedMessage to forward ea
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
新信息:结果表明收件人已正确填充并放入“我的发件箱”,但未发送。此外,会弹出一个新窗口,其中包含相同的转发邮件和一个空白收件人。这个新窗口就是我看到的,让我相信收件人没有出现 我现在的解决办法是定期点击Outlook中的“发送/接收”按钮,发送发件箱中的邮件。我不知道为什么这些邮件不会像其他邮件一样自动发送。然后我补充说: 关闭窗口1 要关闭打开的窗口-不知道为什么要创建它,也不想要它,但不妨关闭它,然后继续
因此,我确实让它工作了,但它并不优雅。我终于想出了如何工作:在设置电子邮件属性(尤其是收件人)之前,不要打开“转发电子邮件”窗口 以下是我的测试脚本:
主持人注意:是否有办法获得AppleScript的语法突出显示?2017-04-26 CT下午7:32-我也有同样的问题。我需要转发邮件,但在发送前设置收件人和主题。主题的更改在前向窗口中显示,但我找不到一种方法来显示新的收件人。这是一个正常的语法,就像在代码块之前,例如C++。但我不确定是否支持applescript高亮显示,如果来自的内容足够接近,您可以尝试。
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"