简体   繁体   English

Applescript:邮件签名的怪异

[英]Applescript: weirdness with mail signatures

I am writing an applescript which works as an email merge that takes information from a Numbers document (name, email address, license codes, promo codes) and generates an email in Mail. 我正在编写一个AppleScript脚本,用作电子邮件合并,从Numbers文档(名称,电子邮件地址,许可证代码,促销代码)中获取信息,并在Mail中生成电子邮件。 After inserting the base & dynamic content, some text formatting occurs (making text bold and red or blue). 插入基本和动态内容后,会发生一些文本格式化(使文本变为粗体,红色或蓝色)。 The code works, but the message signature disappears once some of the content is edited. 代码有效,但一旦编辑了某些内容,消息签名就会消失。 The signature is there but it disappears seconds later. 签名就在那里,但几秒钟后就消失了。

However, if I set a breakpoint (using Script Debugger) on the line the message signature is set, it works just fine. 但是,如果我在行上设置断点(使用脚本调试器),则设置了消息签名,它可以正常工作。 Below is a sample code which illustrates the point: 下面是一个示例代码,说明了这一点:

    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

Additionally, even though the property visible is set to false, it shows up anyway. 此外,即使属性visible设置为false,它仍会显示。 Running on OS X Yosemite, but this issue has also happened in Mavericks. 在OS X Yosemite上运行,但这个问题也发生在小牛队。

Any thoughts? 有什么想法吗?

Create the signature with the message. 使用消息创建签名。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM