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

发布于 2025-01-04 07:00:14 字数 726 浏览 1 评论 0原文

我将以下脚本与 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小忆控 2025-01-11 07:00:14

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文