diff unixSoft/otherbin/Archive Message.applescript @ 215:ca0e1cff654c

Add an applescript I use to archive messages in Mail.app
author Augie Fackler <durin42@gmail.com>
date Sat, 14 Aug 2010 20:42:58 -0500
parents
children
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/unixSoft/otherbin/Archive Message.applescript	
@@ -0,0 +1,23 @@
+tell application "Mail"
+	set selectedMails to the selection
+	if the length of selectedMails is greater than 0 then
+		repeat with theMessage in selectedMails
+			if the name of the mailbox of theMessage is "INBOX" then
+				# Set "gmail" to whatever your account is called in Mail.app's preferences
+				if the account of the mailbox of theMessage is account "gmail" then
+					# Note: instead of "All Mail" below, I had to use "[Gmail]/All Mail" -Simon, using Mail 3.5 (930.3) & Gmail w/ IMAP
+					move theMessage to mailbox "[Gmail]/All Mail" in account "Gmail"
+					# Add custom accounts with custom names and custom archive mailboxes here
+				else if the account of the mailbox of theMessage is account "Google" then
+					move theMessage to mailbox "[Gmail]/All Mail" in account "Google"
+				else
+					say "Your mail didn't belong to any account I know."
+				end if
+			else
+				say "Only mails in inbox can be moved"
+			end if
+		end repeat
+	else
+		say "You have to select mails first"
+	end if
+end tell