The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Snow Leopard mail rule bug? (http://forums.omnigroup.com/showthread.php?t=14204)

Mark Stanczak 2009-10-19 07:24 PM

Snow Leopard mail rule bug?
 
Hi, all. Could someone verify something for me so I know I'm not going crazy?

I've written an applescript to process messages from Mail.app and create a project & actions based on the mail content. The script is called from a mail rule.

However, Mail only sends Omnifocus the expected message if I apply the rule manually. If a new mail item automatically triggers the rule, Mail sends along the next most recent item in my inbox (in other words - the message that came in BEFORE the message that's actually triggering the rule).

Is this a bug or did I mess up the script? Here's the basic loop that I use in my script:

[CODE]on perform_mail_action(theData)
tell application "Mail"
set theSelectedMessages to |SelectedMessages| of theData
set theRule to |Rule| of theData
repeat with a from 1 to count theSelectedMessages
set thesubject to subject of item a of theSelectedMessages
display dialog thesubject
end repeat
end tell
end perform_mail_action
[/CODE]

Thanks for your help!

Mark Stanczak 2009-10-20 10:48 AM

Here's the mail rule I'm using:

[CODE]If all of the following conditions are met:
Subject Begins with "trigger script"

Perform the following actions:
Mark as Flagged
Run Applescript (path)
[/CODE]

When this rule is enabled Mail finds the incoming message "trigger script" and marks it flagged. So I thinks to myself "The messages that Mail.app flags and the messages that Applescript receives must be identical, right?"

But it doesn't look that way. The applescript creates a dialog box and prints some other email's subject.

This is my first attempt at applescript. I'm totally stumped. :confused:

Any ideas?

Thanks


All times are GMT -8. The time now is 12:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.