Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>AppleScript - bitte um Unterstützung

AppleScript - bitte um Unterstützung

saitist
saitist08.09.1210:34
Hallo, ich möchte in Apple Mail ordnerspezifisch bestimmen, dass Mails die älter sind als z.B. 30 Tage dann automatisch in den Papierkorb bewegt werden. In Outlook ging das über sogenannte "Zeitpläne".

In Mail offensichtlich nur über AppleScript. Leider habe ich keine Ahnung davon und wollte Euch bitten, ob jemand mir eines erstellen könnte.

Vielen Dank.
0

Kommentare

_mäuschen
_mäuschen08.09.1212:05
http://hints.macworld.com/dlfiles/mail_move_scpt.txt
0
saitist
saitist08.09.1213:25
Vielen Dank. Aber wo trag ich jetzt den Ordnername ein, den ich durchsuchen möchte? Wie heißt das Gegenteil in der Scriptsprache von ExcludeList
0
_mäuschen
_mäuschen08.09.1215:23
set IncludeList to {"KPT", "zeDivers"} -- mailboxes you want to search
set DestinFolderName to "Archiv" -- mailbox to move messages to. If you want to just delete them, leave it blank

set StaleTime to 160 -- days old the message must be before moved or deleted
set ShowMailboxesProgress to true -- determines if you want the "Processing" box displayed for each mailbox
set currentdate to (current date)

tell application "Mail"
if DestinFolderName is not equal to "" then
if not (exists mailbox DestinFolderName) then
set mbox to make new mailbox with properties {name:DestinFolderName}
end if
end if
set everyAccount to every account

-- Get acount-specific mailboxes
repeat with eachAccount in everyAccount
set everyMailbox to every mailbox of eachAccount
set accountName to the name of eachAccount
repeat with theMailbox in everyMailbox
set currentMailbox to theMailbox
set mailboxName to the name of currentMailbox
if mailboxName is in IncludeList then
if ShowMailboxesProgress then
display dialog "Processing folder " & mailboxName & " in account " & accountName
end if
try
set messages_list to every message of mailbox mailboxName
repeat with i from 1 to number of items in messages_list
set theMessage to item i of messages_list
set difference to (currentdate - (date sent of theMessage)) div days
if difference is greater than StaleTime then
if DestinFolderName is not equal to "" then
move theMessage to mailbox DestinFolderName
else
delete theMessage
end if
end if
end repeat
end try
end if
end repeat
end repeat

-- Get global mailboxes
repeat with theMailbox in every mailbox
set currentMailbox to theMailbox
set mailboxName to the name of currentMailbox
if mailboxName is in IncludeList then
if ShowMailboxesProgress then
display dialog "Processing folder " & mailboxName
end if
try
set messages_list to every message of mailbox mailboxName
repeat with i from 1 to number of items in messages_list
set theMessage to item i of messages_list
set s to the subject of theMessage
set difference to ((currentdate) - (date sent of theMessage)) div days
if difference is greater than StaleTime then
if DestinFolderName is not equal to "" then
move theMessage to mailbox DestinFolderName
else
delete theMessage
end if
end if
end repeat
end try
end if
end repeat

display dialog "Finished!"
end tell
0
saitist
saitist08.09.1218:59
Perfekt! Herzlichen Dank.
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.