View Single Post
I took Omni's script for Apple Mail and modified it with my beginner skills (I taught Applescript to my self an hour ago) to work with Entourage. Most of the code is under the copyright protection of the OmniGroup. So I hope they don't mind since it gives their product added usefulness.

The only caveat is in their code they have a loop that looks like it supposed to process a group of messages and I could not the the loop to work. I kept getting some weird error. Maybe someone could fix that.

Anyway, copy and save this code in Apple Script Editor, then create a rule as shown below (I added the notification rule so that I can see when a new rule appears, since I gave my wife permission to send honey-do's. Dangerous, I know).

using terms from application "Microsoft Entourage"
	-- Trims "foo <>" down to ""
	on trim_address(theAddress)
			set AppleScript's text item delimiters to "<"
			set WithoutPrefix to item 2 of theAddress's text items
			set AppleScript's text item delimiters to ">"
			set MyResult to item 1 of WithoutPrefix's text items
		on error
			set MyResult to theAddress
		end try
		set AppleScript's text item delimiters to {""} --> restore delimiters to default value
		return MyResult
	end trim_address
	on process_message(theMessage)
		-- Allow the user to type in the full sender address in case our trimming logic doesn't handle the address they are using.
		set theSender to sender of theMessage
		set trimmedSender to address of theSender
		tell application "OmniFocus"
			set AllowedSender to allowed mail senders
			if AllowedSender does not contain trimmedSender and AllowedSender does not contain theSender then
			end if
		end tell
		set theSubject to subject of theMessage
		set singleTask to false
		if (theSubject starts with "Fwd: ") then
			-- Whole forwarded messages shouldn't split.
			set singleTask to true
			set theSubject to text 6 through -1 of theSubject
		end if
		set theText to theSubject & return & content of theMessage
		tell application "OmniFocus"
			tell default document
				parse tasks with transport text theText as single task singleTask
			end tell
		end tell
	end process_message
	tell application "Microsoft Entourage"
			set theMsg to item 1 of (get current messages)
			log theMsg
			my process_message(theMsg)
		on error m number n
			tell application "OmniFocus"
				log "Exception in Entourage action: (" & n & ") " & m
			end tell
		end try
	end tell
end using terms from
Attached Files
File Type: zip (5.2 KB, 245 views)