Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set _description to "Alle nicht markierten und gelesenen Nachrichten einer IMAP-Inbox werden in den Ordner 'Archiv' auf dem jeweiligen Server verschoben."
  2.  
  3. tell application "Mail"
  4.     display alert "Archivieren?" buttons {"Abbruch", "Archivieren"} cancel button 1 message _description
  5.    
  6.     repeat with _acct in imap accounts
  7.         set _acct_name to name of _acct
  8.         set _inbox to _acct's mailbox "INBOX"
  9.         try
  10.             if (_acct_name is "Gmail") then
  11.                 set _archive_box to _acct's mailbox "[Gmail]/Alle Nachrichten"
  12.             else
  13.                 set _archive_box to _acct's mailbox "Archiv"
  14.             end if
  15.         on error
  16.             display alert "Kein Archiv-Ordner für das Konto '" & _acct_name & "' gefunden. Sie müssen zuerst einen IMAP-Ordner namens 'Archiv' erstellen!"
  17.             return -- Stop the script
  18.         end try
  19.         set _msg_list to (every message of _inbox whose flagged status is false and read status is true)
  20.         if (_msg_list's length > 0) then
  21.             move _msg_list to _archive_box
  22.         end if
  23.     end repeat
  24. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement