跳至內容

AppleScript 程式設計/示例程式/存檔已選擇的郵件

來自 WikiBooks,開放世界的開放書籍

據說該指令碼告訴 Mail.app 將所選郵件移動到某個目錄/郵箱中。應該可以與 Gmail 配合使用,但不是通用指令碼。除非該指令碼的所有內容均已配置,否則該指令碼無法工作。

(* This script is commented out because it needs work.
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 "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 "uni" then
				--	move theMessage to mailbox "Archive" in account "uni"
				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
*)
華夏公益教科書