一键转发标记的消息。苹果脚本

时间:2019-12-11 08:58:22

标签: applescript

我有一个AppleScript,其任务是将标记的邮件转发到另一封电子邮件(在标准Apple Mail应用程序中),但是它无法按我的需要工作。我将此脚本作为服务添加到了Automator中。

我必须 1)标记消息。 2)转到服务,然后选择我需要的“转发标记的邮件”服务,然后才将它们一次转发。

我的想法是在标记带有标记的消息后立即自动将传入消息转发给助手。 有人可以纠正我的AppleScript吗? 还是我误将其引入服务中?

请帮助我!

set toAddress to "alex@example.com"
set toName to "Alex"

tell application "Mail"
    repeat with _acct in imap accounts
        --Look For Flagged Messages in the INBOX
        set _acct_name to name of _acct
        set _inbox to _acct's mailbox "INBOX"
        set _msgs_to_capture to (a reference to ¬
            (every message of _inbox ¬
                whose flagged status is true))

        repeat with _msg in _msgs_to_capture
            set _fwdmsg to forward _msg with opening window

            tell _fwdmsg
                make new to recipient at end of ¬
                    to recipients with properties {name:toName, address:toAddress}
            end tell

            activate

            send _fwdmsg
        end repeat
    end repeat
end tell

0 个答案:

没有答案