• Das kreative Thema des Monats Oktober wird vor allem diejenigen unter Euch besonders ansprechen, denen Do-it-yourself quasi im Blut liegt. Zeigt uns Eure Improvisationskünste oder fotografiert, was andere Leute sich so im Alltag zusammengestrickt haben. --> Zum Mitmachen bitte hier klicken

AppleScript als Mailfilter

  • Ersteller Ersteller mikethemechanic
  • Erstellt am Erstellt am

mikethemechanic

Gast
Hallo zusammen,

vielleicht kann mir von euch jemand helfen ich habe ein AppleScript geschrieben, welches als Rule im Mail Programm eingerichtet ist.

Momentan werden alle Mails deren Subject mit TEST: beginnen an das Script gereicht. Dieses Löscht das Test: fügt den Subject als Todo in iCal ein. Danach soll es die Mail löschen.

Wenn ich nun die Rule als normales Applescript habe stürzt Mail ab, wenn ich nun ein AppleScript als Programm abspeichere und es nutze stürzt mail nicht ab und die todos werden in iCal eingetragen, aber die Mails nicht gelöscht.

Vielleicht weiß jemand von euch rat?

Hier das Script:

Code:
using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
        tell application "Mail"
            repeat with eachMessage in theMessages
                set mymessage to subject of eachMessage
                set countofit to count of mymessage
                set todomessage to text 7 thru countofit of mymessage
                
                tell application "iCal"
                    set newtodo to (make new todo at end of todos of calendar "Privat")
                    tell newtodo
                        set priority to medium priority
                        set summary to todomessage
                    end tell
                end tell
                delete eachMessage
            end repeat
        end tell
    end perform mail action with messages
end using terms from
Vielen Dank schon mal und lieben Gruß

Mike