|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
Registered User
Join Date: Jan 2013
Posts: 1
|
Why doesn't this simple applescript work any more in ML mail.app (as a rule)
It works only when you right click on the mail message and choose "run rules", but not on incoming messages (without interaction).
The first dialog is shown both when incoming or running manually, but the second dialog (with the id) is only shown when running manually. Nothing is shown in console.log Any ideas? Code:
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with theMessage in theMessages
display dialog "inside"
set theId to id of theMessage
display dialog "the id is " & theId
end repeat
end tell
end perform mail action with messages
end using terms from
|
|
|
|
|
|
#2 |
|
MVP
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,009
|
That's a bug in Mail. Sometimes it doesn't assign an id to a message right away. Attempting to get the id throws an exception. Usually the id has been set on an incoming message before your rules run, but not always. Even if the id has been set, Mail may show only some of the headers. I've reported it to Apple, and encourage you to do likewise.
I had to modify the AppleScripts I run from rules so that they detect missing id and/or missing but important headers, and defer such messages until later. (I set their color to an otherwise unused color, and schedule a shell script to run 10 seconds later. That script runs the AppleScript again, which this time processes all messages with that color. It gives up on a message that still seems incomplete after four such cycles.) |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|