【问题标题】:Applescript for Outlook v15 - Recipients won't populateApplescript for Outlook v15 - 收件人不会填充
【发布时间】:2017-08-16 09:39:32
【问题描述】:

我在网站上复制了一些脚本,结果是 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

【问题讨论】:

  • 2017-04-26 7:32 PM CT -- 我遇到了同样的问题。我需要转发消息,但在发送之前设置收件人和主题。对主题的更改显示在“转发”窗口中,但我找不到显示新收件人的方法。

标签: outlook applescript


【解决方案1】:

新信息:事实证明 收件人 已正确填写并放入我的发件箱,但未发送。此外,还会弹出一个新窗口,其中包含相同的转发消息和空白recipient。我看到的那个新窗口让我相信收件人没有填充。

我现在的解决方法是定期点击 Outlook 中的发送/接收按钮以发送位于发件箱中的邮件(我不知道为什么它们不像其他所有邮件一样自动发送)。然后我补充说:

关闭窗口 1

关闭打开的窗口 -- 不知道为什么创建它并且不想要它,但还不如关闭它并继续。

所以我确实让它工作了,但它并不优雅。

【讨论】:

    【解决方案2】:

    我终于想出了如何实现这一点:在设置电子邮件属性(尤其是收件人)之前,不要打开转发的电子邮件窗口。

    这是我的测试脚本:

    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 的语法高亮显示?

    【讨论】:

    • 正常的语法是在你的代码块前加上<!-- language: lang-cpp -->之类的东西,例子是C++。但我不确定是否支持 applescript 高亮显示,您可以尝试来自 this list 的内容是否足够接近。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多