The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   Process Entourage messages into Actions SOLUTION!!! (http://forums.omnigroup.com/showthread.php?t=7814)

dbrajkovic 2008-04-18 09:19 AM

Process Entourage messages into Actions SOLUTION!!!
 
1 Attachment(s)
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).

[IMG]http://www.brajkovic.com/Rule.png[/IMG]

[CODE]using terms from application "Microsoft Entourage"
-- Trims "foo <foo@bar.com>" down to "foo@bar.com"
on trim_address(theAddress)
try
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
return
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"
try
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[/CODE]

Geordan 2008-04-20 01:29 PM

I can't wait to try this at work tomorrow.

denno 2008-04-23 07:16 PM

seems to work great--thanks!!

dave1304 2008-04-24 02:44 AM

Doesn't work for me. :-(
I have a german system, german entourage and german omnifocus.
maybe that's the problem?

timesauce 2008-08-18 02:24 PM

Brilliant! Works really well so far. Thanks for posting!

jamester 2009-01-30 04:24 PM

This is a great rule-script combo as it runs without any user intervention. Is is possible to make the Entourage message become an attachment in the OmniFocus task?

Thanks

jshaevitz 2009-02-08 06:09 AM

FYI: Information about adding a link to the original Entourage message can be found here:

[url]http://forums.omnigroup.com/showthread.php?t=7769&page=3[/url]


All times are GMT -8. The time now is 07:55 PM.

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