Applescript 在 Apple Mail 中选择特定收件箱

发布于 2024-12-27 00:56:42 字数 491 浏览 4 评论 0原文

我是 Applescript 新手,遇到了一个问题。我的邮件“收件箱”中有多个文件夹。但是,我只想选择这些收件箱之一来运行脚本。

这是我所拥有的。但是,我似乎找不到 Gmail 帐户的收件箱。

有什么想法吗?

    set _ago to (current date) - days
    set _inbox to "Inbox:Gmail"

    tell application "Mail"
        move (messages of _inbox whose read status is false and date received comes before _ago) to mailbox "Gmail - Unread"
        move (messages of _inbox whose date received comes before _ago) to mailbox "Gmail - Archive"
    end tell

I am new to Applescript and I am running into an issue. I have multiple folder in my Mail "Inbox". However, I would like to just select one of these inboxes to run the script on it.

Here is what I have. However, I cannot seem to find the Inbox for the Gmail account.

Any ideas?

    set _ago to (current date) - days
    set _inbox to "Inbox:Gmail"

    tell application "Mail"
        move (messages of _inbox whose read status is false and date received comes before _ago) to mailbox "Gmail - Unread"
        move (messages of _inbox whose date received comes before _ago) to mailbox "Gmail - Archive"
    end tell

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

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

发布评论

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

评论(1

妄司 2025-01-03 00:56:42

虽然我没有在任何地方看到过这个记录,但收件箱似乎总是名为“INBOX”的邮箱(大小写很重要)。因此,以下是我所做的当我需要访问特定于帐户的收件箱时

set _inbox to mailbox "INBOX" of account "Gmail"

这与访问任何邮箱的方式相同,只需使用此特定名称即可。另请注意,您可能还需要在 move 语句中使用帐户“Gmail”的邮箱“未读” 表单,但我不确定;你需要测试一下。

It seems, although I haven't seen this documented anywhere, that inboxes are always mailboxes named "INBOX" (case matters). Thus, the following is what I do when I need to access an account-specific inbox:

set _inbox to mailbox "INBOX" of account "Gmail"

It's the same way you'd access any mailbox, you just use this particular name. Note also that you might need to use the mailbox "Unread" of account "Gmail" form in your move statements as well, but I'm not sure; you'd need to test this.

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