Erinnerung aus Mail

S

Schmedt

Neues Mitglied
Thread Starter
Dabei seit
27.01.2019
Beiträge
14
Reaktionspunkte
0
Hallo zusammen,

ich suche schon lange eine Möglichkeit, dass anhand einer Mailregel ein Skript ausgeführt wird und mir eine Automatische Erinnerung eingetragen wird nach "2" ,"14" und "60" Tagen

jetzt habe ich ein Skript, was aber leider nicht richtig funktioniert , da muss die Mail markiert sein .

ist es denn möglich, dass das Skript im Hintergrund läuft und mir die Mailregel die Erinnerung einträgt.

Von Skript schreiben habe ich leider keine Ahnung und bin auf Hilfe angewiesen.

mein Skript sieht folgendermaßen aus :

Code:
tell application "Mail"


   


    set _selection to selection


    set _message to item 1 of _selection


    set _from to (sender of _message as string)


    set _subject to (subject of _message as string)


    set _body to content of _message


    set _body to paragraph 1 of _body & return & paragraph 2 of _body & return & paragraph 3 of _body


    set _ID to message id of _message


    set _URL to "message://%3c" & _ID & "%3e"


    set _alarm to ((current date) + 2 * days)


    set time of _alarm to 60 * 60 * 9


end tell





tell application "Reminders"


    make new reminder with properties {name:"1. Nachfassen", body:"Von: " & _from & return & _body & return & _URL, remind me date:_alarm}


end tell








tell application "Mail"


   


    set _selection to selection


    set _message to item 1 of _selection


    set _from to (sender of _message as string)


    set _subject to (subject of _message as string)


    set _body to content of _message


    set _body to paragraph 1 of _body & return & paragraph 2 of _body & return & paragraph 3 of _body


    set _ID to message id of _message


    set _URL to "message://%3c" & _ID & "%3e"


    set _alarm to ((current date) + 14 * days)


    set time of _alarm to 60 * 60 * 9


end tell





tell application "Reminders"


    make new reminder with properties {name:"2. Nachfassen", body:"Von: " & _from & return & _body & return & _URL, remind me date:_alarm}


end tell








tell application "Mail"


   


    set _selection to selection


    set _message to item 1 of _selection


    set _from to (sender of _message as string)


    set _subject to (subject of _message as string)


    set _body to content of _message


    set _body to paragraph 1 of _body & return & paragraph 2 of _body & return & paragraph 3 of _body


    set _ID to message id of _message


    set _URL to "message://%3c" & _ID & "%3e"


    set _alarm to ((current date) + 60 * days)


    set time of _alarm to 60 * 60 * 9

end tell

tell application "Reminders"


    make new reminder with properties {name:"3. Nachfassen", body:"Von: " & _from & return & _body & return & _URL, remind me date:_alarm}


end tell


Vielen Dank schon mal

Gruß
Schmedt
 
Zuletzt bearbeitet von einem Moderator:
Hallo zusammen,

was müsste ich vor das Makro schreiben, dass die neu eingetroffene Mail markiert wird.

Gruß
Schmed
 
Hallo,

aus dem Mail Benutzerhandbuch:
Skripts als Regelaktionen in Mail auf dem Mac verwenden

Und hier die nötigen Änderungen in deinem Code

Code:
using terms from application "Mail"
   
    on perform mail action with messages theMessages for rule theRule
       
       
        tell application "Mail"
           
            repeat with _message in theMessages
               
               
                set _from to (sender of _message as string)
               
               
                set _subject to (subject of _message as string)
               
               
                set _body to content of _message
               
               
                set _body to paragraph 1 of _body & return & paragraph 2 of _body & return & paragraph 3 of _body
               
               
                set _ID to message id of _message
               
               
                set _URL to "message://%3c" & _ID & "%3e"
               
               
                set _alarm to ((current date) + 2 * days)
               
               
                set time of _alarm to 60 * 60 * 9
               
               
               
               
                tell application "Reminders"
                   
                   
                    make new reminder with properties {name:"1. Nachfassen", body:"Von: " & _from & return & _body & return & _URL, remind me date:_alarm}
                   
                   
                end tell
               
            end repeat
           
        end tell
    end perform mail action with messages
end using terms from
--ungetestet

(Es gibt auch eine Vorlage mit Beispielen für eine Mail Regel im Skripteditor. Zu finden im Menü "Neu aus der Vorlage")


Gruß
 
Zurück
Oben Unten