无法通过Apple脚本访问邮件应用中的邮件附件

时间:2016-11-03 18:27:06

标签: macos applescript

我们假设在以下代码中

let options = [
        "" : ""
    ]

    _ = session?.recognize(withType: SKTransactionSpeechTypeDictation, detection: .long, language: "eng-USA", options: options, delegate: self)

第一个帐户的第一个邮箱的第一条消息实际上有附件。让我们进一步假设有问题的帐户是GMail帐户(可能证明是相关的),而且我在El Capitan上尝试这个帐户。

在“set myAttachments”行中,我总是收到错误“苹果事件例程中的错误,-10000”(从德语中丢失)。我在旧线程中读到,访问附件确实存在错误。但我也看到了一个新的主题,它正在讨论如何最好地处理它们的细节(没有提到根本没有访问权限)。

我错过了什么?它有用吗?也许一般而不是GMail?我必须做一些特定的事情吗?

谢谢!

桑德罗

1 个答案:

答案 0 :(得分:-1)

这个的确切语法是“myMessage的邮件附件”(没有“s”)。 对于选定的电子邮件,下面的脚本非常适合我:

tell application "Mail"
activate
set ListMessage to selection
repeat with aMessage in ListMessage
    set AList to every mail attachment of aMessage
    repeat with aFile in AList
        if (downloaded of aFile) then
            -- do something with aFile 
        end if
    end repeat -- next file
end repeat -- next message
end tell

您确定带有附件的邮件是否在您的第一个帐户/第一个邮箱中?

相关问题