View Single Post
Solution found. Is this useful? How could it be improved?

Code:
using terms from application "Mail"
	on perform mail action with messages theMessages
		tell application "Mail"
			
			repeat with eachMessage in theMessages
				set theStart to missing value
				set theDue to missing value
				
				set theTitle to the subject of eachMessage
				set theNotes to the content of eachMessage
				set theSender to sender of eachMessage
				
				try
					set itemTitle to the text returned of (display dialog "Item title" buttons {"Cancel", "Save"} default button "Save" cancel button "Cancel" default answer theTitle)
				on error number -128
					set userCanceled to true
				end try
				
				set theCombinedBody to "Created from message:%3C" & message id of eachMessage & "%3E" & return & "From: " & theSender & return & return & theNotes
				
				tell application "OmniFocus"
					tell default document
						set newTaskProps to {name:itemTitle}
						--						if theStart is not missing value then set newTaskProps to newTaskProps & {start date:theStart}
						--						if theDue is not missing value then set newTaskProps to newTaskProps & {due date:theDue}
						if theCombinedBody is not missing value then set newTaskProps to newTaskProps & {note:theCombinedBody}
						
						set newTask to make new inbox task with properties newTaskProps
					end tell
				end tell
			end repeat
		end tell
	end perform mail action with messages
end using terms from
Here is the finished script: http://bit.ly/11xwgfM

Put it in ~/Library/Application Scripts/com.apple.mail/

I was having some problems getting the Mail Act-On rules to all work within a single rule, so at their suggestion I've broken the actions into who separate rules to move the message and then run the script.

Step 1 Runs the applescript then calls the second rule


Step 2 Files the message in an Action mailbox