我写了一个由邮件规则调用的脚本。我希望脚本在特定条件下将邮件移动到垃圾箱。它没有工作,所以我已经评论了测试,但它仍然无法正常工作。我从一个在线教程中获得了代码。该教程将消息移至“归档”。当我将这个调用替换为垃圾时,该规则本身起作用。下面是我测试:使用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