问题
I'm using the following script with a Mail.app rule.
It seems that on my computer the code isn't being executed after moving the message to the Trash mailbox. (adayzdone below reports it works for him).
How can I identify the reason for this and solve it?
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with eachMessage in theMessages
set theText to content of eachMessage
--
-- ... here happens some processing
--
-- this works:
move eachMessage to mailbox "Trash"
-- but this doesn't:
display dialog "reached this point"
-- i.e. additional code I'm adding here isn't executed...
end repeat
end perform mail action with messages
end using terms from
回答1:
Calling it with a rule from Mail, this script works for me. Are you sure the message is reaching the inbox and not getting caught in a filter such as "skip inbox" from gmail?
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with eachMessage in theMessages
set theText to content of eachMessage
move eachMessage to mailbox "Trash"
display dialog "reached this point"
beep 2
end repeat
end perform mail action with messages
end using terms from
来源:https://stackoverflow.com/questions/9243825/applescript-aborts-execution-after-moving-a-mail-message