【问题标题】:Applescript: weirdness with mail signaturesApplescript:邮件签名的奇怪之处
【发布时间】:2015-02-24 14:24:23
【问题描述】:

我正在编写一个作为电子邮件合并的 AppleScript,它从 Numbers 文档中获取信息(姓名、电子邮件地址、许可证代码、促销代码)并在 Mail 中生成电子邮件。插入基本和动态内容后,会出现一些文本格式(使文本变为粗体和红色或蓝色)。该代码有效,但是一旦编辑了某些内容,消息签名就会消失。签名在那里,但几秒钟后消失了。

但是,如果我在设置消息签名的行上设置断点(使用脚本调试器),它就可以正常工作。以下是说明这一点的示例代码:

    tell application "Mail"
        set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false})
        tell theMsg
            make new to recipient with properties {name:"Josh Booth", address:"none@none.com"}
            set character 1 to "Y"
            set color of character 1 to {60000, 1, 1}
        end tell
        set theMsg's message signature to signature "JB_SocialMedia"
        log "Fin"
    end tell

此外,即使属性 visible 设置为 false,它仍然会显示出来。在 OS X Yosemite 上运行,但这个问题也发生在 Mavericks 中。

有什么想法吗?

【问题讨论】:

    标签: email applescript


    【解决方案1】:

    使用消息创建签名。

    tell application "Mail"
        set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false, message signature:signature "JB_SocialMedia"})
        tell theMsg
            make new to recipient with properties {name:"Josh Booth", address:"none@none.com"}
            set character 1 to "Y"
            set color of character 1 to {60000, 1, 1}
        end tell
        log "Fin"
    end tell
    

    【讨论】:

      猜你喜欢
      • 2015-05-30
      • 2012-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多