【问题标题】:Apple Mail and ApplescriptApple 邮件和 Applescript
【发布时间】:2020-02-19 02:59:49
【问题描述】:

我已经让这个脚本在 Outlook 2011 for Mac 上运行良好,一切都在本地机器上。

我现在发现,经过这么多年,我的“规则”现在适用于 Apple 邮件。 规则的最后一部分是运行此脚本,然后将 HTML 电子邮件发送回发件人。 如果我将告诉应用程序“Microsoft Outlook”更改为告诉应用程序“邮件”,我会不断收到语法错误,它会突出显示“邮件文件夹”,告诉我这是错误的。 我难住了。 我正在将 Exchange 与 Mail 应用程序一起使用。不确定这是否是问题所在?

tell application "Microsoft Outlook"
    set replyToMessage to message 1 of mail folder "•HOT FOLDER•"
    if (replyToMessage is "") then
        log ("NOTHING SELECTED!")
        return
    end if
    set replyMessageSubj to subject of replyToMessage
    set replyMessage to reply to replyToMessage without opening window
    set contentHTML to "Vault:Users:vault:Documents:VAULT:Digital_Subscription_Reply:Digital_issue22.html" as alias
    set contentHTML to read contentHTML
    set the content of replyMessage to contentHTML
    set the subject of replyMessage to "Vault Digital Issue - Issue 22"
    send replyMessage
end tell

【问题讨论】:

    标签: applescript


    【解决方案1】:

    每个可编写脚本的应用程序都有自己的脚本字典和自己独特的术语。我们不能仅仅将tell application "Microsoft Outlook" 更改为tell application "Mail" 并期望它能够工作,因为Mail 和Outlook 对它们的等效对象使用不同的关键字。我的机器上没有安装 Outlook,因此无法编译或运行原始脚本,但我已尽我所能对其进行了修改以使用 Mail 术语。不保证这会起作用,但它会编译并运行,因此您可以(至少)对其进行测试。

    tell application "Mail"
        set replyToMessage to message 1 of mailbox "•HOT FOLDER•"
        if (replyToMessage is "") then
            log ("NOTHING SELECTED!")
            return
        end if
        set replyMessageSubj to subject of replyToMessage
        set replyMessage to reply replyToMessage without opening window
        set contentHTML to "Vault:Users:vault:Documents:VAULT:Digital_Subscription_Reply:Digital_issue22.html" as alias
        set contentHTML to read contentHTML
        set the content of replyMessage to contentHTML
        set the subject of replyMessage to "Vault Digital Issue - Issue 22"
        send replyMessage
    end tell
    

    当您在脚本编辑器中时,从文件菜单中选择“打开字典...”并向下滚动以打开邮件脚本字典。这将为您提供编写 Mail.app 脚本的所有相关术语。

    【讨论】:

    • 非常感谢 Ted。我使用该代码无济于事,但不确定它在 Apple Mail 中根本不可能,或者我的文件路径错误。我看了字典的东西,但对我来说仍然没有意义。感谢您的尝试。
    猜你喜欢
    • 1970-01-01
    • 2014-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-04
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    相关资源
    最近更新 更多