AppleScript在移动邮件后中止执行?

时间:2012-02-11 20:34:11

标签: applescript

我正在使用以下脚本和Mail.app规则。

似乎在我的计算机上,在将邮件移动到“废纸篓”邮箱后,代码未执行。 (下面的adayzdone报告说这对他有用)。

如何确定原因并解决?

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 个答案:

答案 0 :(得分:0)

使用Mail中的规则调用它,此脚本适合我。您确定邮件是否已到达收件箱并且没有被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