Creating OmniFocus tasks in Entourage – take 4

Omnifocus-1  Creating OmniFocus tasks in Entourage – take 4 Omnifocus 1

This is an update for the people who still use Entourage. Just in time for the holidays it now also supports multiple emails (will end up in multiple tasks). In order to use it simply select multiple mails and hit CTRL+O.

Grab it here: EntourageToOmniFocus_v4

Happy holidays

14 Gedanken zu „Creating OmniFocus tasks in Entourage – take 4“

  1. This is a great handy little script…I wish there was a similar way to do this on the iPhone app…thanks for the script anyway…it really made the last mile for me btw OF and Entourage.

  2. — Hacked in a couple of changes – might be useful for someone
    — Now does not switch to the quickentry window but instead just saves the entry and closes it.
    — Pops up a growl message so the user knows that the quickentry happened
    — Adds the Name [email address] and date to the beginning of the entry to help tracking

    tell application “Microsoft Outlook”

    (* Tell Growl we exist *)
    tell application “GrowlHelperApp”
    set the allNotificationsList to {“Notification”}
    set the enabledNotificationsList to {“Notification”}
    register as application “PH Notify” all notifications allNotificationsList default notifications enabledNotificationsList
    end tell

    — get the currently selected message or messages
    set selectedMessages to current messages

    — if there are no messages selected, warn the user and then quit
    if selectedMessages is {} then
    display dialog “Please select one or more messages first and then run this script.” with icon 1
    end if

    repeat with theMessage in selectedMessages

    set the growlDescription to “Subject:” & subject of theMessage

    set theName to subject of theMessage
    set theContent to content of theMessage
    set theID to id of theMessage as string
    set theSender to sender of theMessage
    set OmniFocusHeader to “From: ” & name of theSender & ” [” & address of theSender & “]” & return & “Date: ” & time sent of theMessage & return & return

    — set the path to a temp area on your HD to temporarily store the attachment to be loaded into OF
    set theFileName to “/tmp/entourage” & theID & “.eml”
    set theOutFileName to “/tmp/outlook-” & theID & “.txt”
    tell application “OmniFocus”
    log “saving the file” & theFileName
    log “out filename ” & theOutFileName
    end tell
    save theMessage in theFileName
    set homeFolder to (path to home folder as text)
    set posixHome to (POSIX path of homeFolder)
    — set theTxtContent to do shell script “”” & posixHome & “/Documents/Microsoft User Data/Outlook Script Menu Items”/decoder < " & theFileName
    do shell script "java -jar "" & posixHome & "/Documents/Microsoft User Data/Outlook Script Menu Items"/MailDecoder.jar " & theFileName & " " & theOutFileName

    tell application "Finder"
    set foo to (open for access (theOutFileName))
    set theTxtContent to OmniFocusHeader & (read foo for (get eof foo) as «class utf8»)
    close access foo
    end tell

    –set theTxtContent to (contents of theOutFile)
    tell application "OmniFocus"
    set theDoc to default document
    set theTask to theName
    set theNote to theTxtContent
    tell quick entry
    set NewTask to make new inbox task with properties {name:theTask, note:theTxtContent}
    tell the note of NewTask
    make new file attachment with properties {file name:theFileName, embedded:true}
    end tell
    end tell
    end tell

    (* Tell the user *)
    tell application "GrowlHelperApp"
    notify with name "Notification" title "Omnifocus quick entry" description growlDescription application name "PH Notify"
    end tell
    — Only Uncomment if you really understand and are happy with the process and want the message to
    — be removed from Entourage after it gets sent to OF

    — delete theMessage
    end repeat (* for each message *)
    end tell

    — bring OmniFocus to the front
    — thanks to tim @ omni for this one
    –tell application "OmniFocus"
    — –activate
    — tell first document window of front document
    — set selected view mode identifier to "project"
    — tell sidebar
    — select inbox
    — end tell
    — end tell
    –end tell
    — delete all the old leftover emails
    do shell script "rm /tmp/entourage*.eml /tmp/outlook*.txt"

  3. A fix; if the subject in the mail is blank then the script originally fails.

    set theName to subject of theMessage
    if theName is missing value then
    set theName to “”
    end if
    set theContent to content of theMessage

    Another tweak. The embedded EML file sometimes sits on the end of the last line of the text for the email, so added a couple of returns

    set foo to (open for access (theOutFileName))
    set theTxtContent to OmniFocusHeader & (read foo for (get eof foo) as «class utf8») & return & return
    close access foo

  4. Just moved to OL2011 and trying your script again. My issue with the script is that when dereferencing the mail message Icon in the Attachment in OF, it works but opens a duplicate message in OL. If the origin OL message was Categorized, I loose that Categorization in the duplicate message. If I open the Conversation View I see both the original and duplicate message. Is there no way to just have a link from OF the OL which does not duplicate the messages? Great work BTW _matt_

  5. Having to switch to Entourage, with Outlook 2011 coming in a few months, how do I get this revised script by Paul to work. Not a code guy but downloaded Rainer’s script but want to incorporate Paul’s changes. Great work – thanks.

      1. Thanks! – I now have it deleting the message from erage, which is great. I’ve commented out the last bit about bringing OF to the front. I didn’t see anything about not popping up the quickentry window, though.

Schreibe einen Kommentar zu Paul Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.