我寫了一個由郵件規則調用的腳本。我希望腳本在特定條件下將郵件移動到垃圾箱。它沒有工作,所以我已經評論了測試,但它仍然無法正常工作。我從一個在線教程中獲得了代碼。該教程將消息移至「歸檔」。當我將這個調用替換爲垃圾時,該規則本身起作用。下面是我測試:使用AppleScript將郵件移動到垃圾箱
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
tell application "Mail"
set the message_count to the count of these_messages
repeat with i from 1 to the message_count
set this_message to item i of these_messages
-- try
-- set this_content to (every character of content of this_message) as Unicode text
-- if this_content is in {"", "?"} then error
-- if "bowles" is not in this_content and "patton" is not in this_content then
set mailbox of this_message to mailbox "Trash"
-- end if
-- on error error_message
-- set this_content to "NO CONTENT"
-- end try
end repeat
end tell
end perform mail action with messages
使用最終條款從
聲明的問題是:設定的this_message郵箱郵箱「廢紙簍」
活動代碼的其餘部分是從的AppleScript編輯器模板。
感謝, 柯特
附:是否有任何書籍處理Apple Mail和MailScript?
你可以嘗試簡單的'移動this_message到郵箱「廢紙簍」' - 但顯然別人也有今天郵寄腳本問題:AppleScript的移動郵件後,中止執行(HTTP://計算器.com/questions/9243825) – Flambino 2012-02-12 00:58:57