AppleScript aborts execution after moving a mail message?

有些话、适合烂在心里 提交于 2019-12-08 12:48:19

问题


I'm using the following script with a Mail.app rule.

It seems that on my computer the code isn't being executed after moving the message to the Trash mailbox. (adayzdone below reports it works for him).

How can I identify the reason for this and solve it?

using terms from application "Mail"
    on perform mail action with messages theMessages
        repeat with eachMessage in theMessages
            set theText to content of eachMessage

            --
            -- ... here happens some processing
            --

            -- this works:
            move eachMessage to mailbox "Trash"

            -- but this doesn't:
            display dialog "reached this point"

            -- i.e. additional code I'm adding here isn't executed...
        end repeat
    end perform mail action with messages
end using terms from

回答1:


Calling it with a rule from Mail, this script works for me. Are you sure the message is reaching the inbox and not getting caught in a filter such as "skip inbox" from gmail?

using terms from application "Mail"
on perform mail action with messages theMessages
    repeat with eachMessage in theMessages
        set theText to content of eachMessage
        move eachMessage to mailbox "Trash"
        display dialog "reached this point"
        beep 2
    end repeat
end perform mail action with messages
end using terms from


来源:https://stackoverflow.com/questions/9243825/applescript-aborts-execution-after-moving-a-mail-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!