Come creare uno script Apple che inoltra un'e-mail flaggata

2

Voglio creare uno script Apple che inoltrerà una email segnalata a [email protected]

Ho provato questo script:

on run

 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 eachMessage in _msgs_to_capture
            set theStart to missing value
            set theDue to missing value
            set theOmniTask to missing value

            set theTitle to the subject of eachMessage
            set theNotes to the content of eachMessage

            set theCombinedBody to "message://%3c" & message id of eachMessage & "%3e" & return & return & theNotes

            tell application "OmniFocus"
                tell default document
                    set newTaskProps to {name:theTitle}
                    if theStart is not missing value then set newTaskProps to newTaskProps & {start date:theStart}
                    if theDue is not missing value then set newTaskProps to newTaskProps & {due date:theDue}
                    if theCombinedBody is not missing value then set newTaskProps to newTaskProps & {note:theCombinedBody}

                    set newTask to make new inbox task with properties newTaskProps
                end tell
            end tell

            set flagged status of eachMessage to false

        end repeat

    end repeat
end tell

end run

Tuttavia, questo script apre OmniFocus invece di inviare semplicemente un'email.

Come cambierei questo script o inizierò con uno nuovo in modo tale che inoltrerà automaticamente un'email segnalata a [email protected]?

    
posta Chris 21.05.2013 - 15:26
fonte

1 risposta

1

Ecco un codice, senza riferimenti all'applicazione OmniFocus, che inoltra tutti i messaggi contrassegnati a un indirizzo impostato. Regola a tuo piacimento ...

Funziona come un incantesimo sul mio macbook Snow Leopard.

set toAddress to "[email protected]"
set toName to "User X"

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 
    
risposta data 22.04.2014 - 20:55
fonte

Leggi altre domande sui tag