Outlook to OmniFocus

So just in time for the public release of Outlook for the Mac this is the update that will make Outlook and OmniFocus play nice with each other. It is an update to the version for Entourage (here). In addition to preventing the nasty error dialog that came up if you used the old script, this will now also process the email content which prevents HTML tags from showing up in your task description in OmniFocus. However, this comes at a price, you have to install a couple of commandline perl tools.

Update 31.10.2010

I have released a new version. Please use that one from now on.

Outlook to OmniFocus take 2

Update 25.10.2010

I have now created a packaged version of the script which does not require you do go through all the trouble with installing tons of dependencies. The downside is that the script file is rather large (15MB). If you dont mind this, it is definitely the easier install.

Download the new script from here SendOutlookToOmniFocus-v2.

Install instructions (updated 2010-10-29):

1. Copy the contents of the zip file to <userhome>/Documents/Microsoft User Data/Outlook Script Menu Items (you can do this even easier by opening Outlook, selecting the script menu item „About this menu…“ and then click „Open Folder“.

2. Go to terminal into the previously mentioned folder and perform

chmod a+x decoder

For the non terminal warriors (level 75): that means you open terminal and then type

cd Doc (hit the tab key)/Micro(hit the tab key)/Outl(hit the tab key)

the terminal will complete this automatically as you hit tab, so you should then see

cd Documents/Microsoft User Data/Outlook Script Menu Items/

then hit enter and type

chmod a+x decoder

then hit enter again, and you are done.

————

Old outdated info from last time round:

This might not be for the faint of heart but with a nice time machine backup in your back pocket, what can go wrong, eh?

Installation instructions (out of date)

1. I only tested this with Snow Leopard, so if you are using something older, your mileage may vary

2. open Terminal and type in the following

sudo -s
(you will be prompted for your password)
cpan YAML MIME::Parser

Now you will be asked a ton of questions, I always take the default answer by hitting the Enter key. This will seriously take a couple of minutes (sorry, perl wants to download half of the internet in order to satisfy a single dependency).

3. You can close terminal now

3. Almost done, now copy the contents of the zip file to <userhome>/Documents/Microsoft User Data/Outlook Script Menu Items (you can do this even easier by opening Outlook, selecting the script menu item „About this menu…“ and then click „Open Folder“.

4. now you should be good to go.

In case something goes horribly wrong

I obviously dont hope that it does, but please open console and watch for suspicious messages. Typically this will give you some idea.

Also it might be useful to try and run the script manually and see if it reports issues. You can do this by opening Terminal, navigating to the script menu folder (cd ~/Documents/Microsoft User Data/Outlook Script Menu Items) and then executing

perl decoder.pl

If this returns some errors then you have done something wrong, re-read the install instructions and try and be extra careful when you repeat them.

This program wants to read from the standard input, since you dont really have anything right now, you can hit Ctrl-C now.

Download

Download the file here: SendOutlookToOmniFocus.

55 Gedanken zu „Outlook to OmniFocus“

  1. I’ve stop here (it seems something wrong):

    Writing Makefile for MIME::tools
    Could not read ‚/Users/Invoker/.cpan/build/MIME-tools-5.428-qqzwTa/META.yml‘. Falling back to other methods to determine prerequisites
    DONEILL/MIME-tools-5.428.tar.gz
    make — NOT OK
    Warning (usually harmless): ‚YAML‘ not installed, will not store persistent state
    Running make test
    Can’t test without successful make
    Running make install
    Make had returned bad status, install seems impossible

    1. @Invoker:
      1. make sure you are running as root,
      2. try cpan YAML first and see if that succeeds, once it does you can do
      cpan MIME::Parser and hopefully this will resolve your problem.

          1. @rainer
            Thanks for your time. I’ve done cpan YAML with root. Got this:

            Warning (usually harmless): ‚YAML‘ not installed, will not store persistent state

            CPAN.pm: Going to build A/AD/ADAMK/YAML-0.72.tar.gz

            Checking if your kit is complete…
            Looks good
            Writing Makefile for YAML
            Could not read ‚/Users/Invoker/.cpan/build/YAML-0.72-azFNnw/META.yml‘. Falling back to other methods to determine prerequisites
            ADAMK/YAML-0.72.tar.gz
            make — NOT OK
            Warning (usually harmless): ‚YAML‘ not installed, will not store persistent state
            Running make test
            Can’t test without successful make
            Running make install
            Make had returned bad status, install seems impossible
            bash-3.2#

            Maybe I need to install something first?

  2. OK. I think I’ve found a problem, but not a solution. When I try to build something, some files a copied to /Users/Invoker/.cpan/build/ but permissions are not right and installer could not read anything.

    1. thanks for your info @invoker. Hmm, that is very odd. I am no real perl wiz either, so I dont really know what the problem is. Do you have snow leopard? I tested it on 2 seperate machines with the instructions and it used to work fine. Maybe you can try and modify the permissions on the file in question. I didnt need any other dependencies, but I do have XCode installed, maybe thats it (fishing in the dark really)?

      1. @Invoker, this script is not entirely necessary. All it does is to process HTML mails and pulls out its text content so that you dont have the nasty XHTML tags inside of your task description. If you can live without this feature, I can attach a modified version that does not require this.

        1. I’ve googled a problem and it seems Xcode for Snow Leopard is a answer. Downloading and installing Xcode to put emails from Outlook to OmniFocus is not a good idea for me.
          Anyway, I’ve modified your previous script to work with ’selected text‘ property. And this is enough for me for now.

  3. I’ve replaced:
    set theTxtContent to do shell script „perl ‚“ & workingDir & „/decoder.pl‘ < " & theFileName

    to

    set theTxtContent to do shell script "decoder < " & theFileName

    Result: OmniFocus got an error: Can't make {missing value, ""} into rich text.

    It seems my AppleScript was wrong

    1. @invoker, I dont think that there is something wrong with the applescript. I think that probably the mail that you are trying to convert contains stuff that the perl extractor cannot deal with. Try on a few other mails, if you keep getting this issue, let me know. The applescript line that I used is

      set theTxtContent to do shell script "'" & workingDir & "/decoder' < " & theFileName

      BTW, if you comment out the last line of the script then the offending email will survive.

  4. OK, scripts now working, but the results are bad 🙁

    I think problem is with encoding. Most messages I am receiving are not in Latin. They are cyrillic. So Note Text in OF is looks like this (after script works):
    —————————-
    =E4=CF=C2=D2=D9=CA =C4=C5=CE=D8, =CB=CF=CC=CC=C5=C7=C9,
    =F3=CF=C7=CC=C1=D3=CE=CF =CE=C1=DB=C5=CA =C4=CF=C7=CF=D7=CF=D2=C5=CE=CE=CF=
    =D3=D4=C9, =CF=D4=D0=D2=C1=D7=CC=D1=C0 =D7=C1=CD =CE=C1 =D3=CF=C7=CC=C1=D3=
    =CF=D7=C1=CE=C9=C5 =CE=CF=D7=D5=C0 =D7=C5=D2=D3=C9=C0 =D0=D2=CF=C5=CB=D4=
    =CE=CF=C7=CF =D2=C5=DB=C5=CE=C9=D1 MDD 1.1.
    =F7 =C4=C1=CE=CE=CF=CA =D2=C5=C4=C1=CB=C3=C9=C9 =C4=CF=CB=D5=CD=C5=CE=D4=C1=
    =CF=D4=D2=C1=D6=C5=CE=D9 =CE=C1=DB=C9 =C4=CF=C7=CF=D7=CF=D2=C5=CE=CE=CF=D3=
    =D4=C9 =D0=CF =C9=DA=CD=C5=CE=C5=CE=C9=C0 =D3=C8=C5=CD=D9 =CF=C2=D2=C1=C2=
    =CF=D4=CB=C9 =DA=C1=D1=D7=CB=C9 =CE=C1 =D3=CF=DA=C4=C1=CE=C9=C5/=C9=DA=CD=
    =C5=CE=C5=CE=C9=C5 =D0=CF=DA=C9=C3=C9=C9 =CD=C1=D4=C5=D2=C9=C1=CC=C1.

    =F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD,
    =F0=C1=D7=C5=CC =F7=C9=CE=CF=C7=D2=C1=C4=CF=D7

    Management & Technology Consultants
    40/4, Bolshaya Ordynka str., Moscow, 119017, Russia
    ———————–

    I can read latin characters but cyrillic are replaced.

    1. can you mail me one of those eml files (if you remove the last line in the applescript) to rburgst at gmail dot com. I can see what I can do but it can take a couple of days. Encoding problems can be a bitch.

  5. thanks for the script. works great! is there anyway to make it so only the selected text in a highlight message gets added to the notes section along with the attachment?

  6. I can’t tell you how much I appreciate you getting this out. I live by OF and was dreading the upgrade until I found you! However, I’m a complete newb when it comes to Terminal settings. I’ve searched for the proper process of changing directories, but it won’t take! For instance, this:

    (user)::~ (user folder)$ cd /microsoft user data/Outlook Script Menu

    doesn’t return any positive result („no such file or directory).

    Any help would be greatly appreciated!!

    1. Remove the first slash from /Microsoft user data. Otherwise it will refer to the root folder of your harddisk. You have to open terminal then do cd Documents/Microsoft User Data/Outlook Script Menu Items

      In fact terminal supports tab completion so you start terminal and type
      cd Do (hit the Tab key) Mic (hit the tab key) …
      And the terminal should auto complete the correct path.

      1. Most excellent, thank you. Worked like a charm. I then pasted „chmod a+x decoder“ once in the recommended folder in Terminal, but to no joy…

        $ cd: Documents/Microsoft User Data/Outlook Script Menu Items/chmod a+x decoder
        -bash: cd:: command not found

        This is a really good exercise in keeping me humble…I have no idea how you guys actually get this language. Thanks again for all your help.

          1. I see you invoked the „Jerry Clause“ above by spelling it out for us Terminally-challenged individuals…smart, and another Thank you.

            Okay, it all worked, or appeared to. When I hit enter, it didn’t provide any funky error messages. Should I then expect to see the „Send to Omni Inbox“ when I right-click on an email message? Is there a reboot needed? Again, sorry for all the newb questions, but maybe I’m providing your readership with at least a few good laughs!

            Thanks!

          2. Rainer, one other question…I use a work-around right now using a gmail account and the „–“ in subject line rule to get emails from my iPhone into OF. Do you know of a script that will allow this? Also, maybe this is your script’s handy work, but when I right-click on the email, no service to get the email to OF. When I go to the preview area and highlight text in the same email, I get a service to send it to OF’s inbox!

          3. Sorry, just realized this is the script to process „–“ rules. Here is the message I get using the „–“ rule:

            While processing message „– Fwd: Your eBay item sold! Apple MacBook Air (MC234LL/A) (13.3″, 2.13GHz, 128GB… (170558791036)“ (ID 42481), the rule „Send to OmniFocus“ could not be successfully executed. The script encountered error „Microsoft Outlook got an error: sh: /Applications/Microsoft Office 2011//decoder: No such file or directory“ during execution.

            Here is the message I get when I copy text in an email and use the right click and choose „Send to Omni Inbox“:

            While processing message „– Fwd: Temple Spa Order Confirmation. TS00159230/269128“ (ID 42480), the rule „Send to OmniFocus“ could not be successfully executed. An unknown error has occurred in Outlook.

            Thanks, Rainer.

          4. @Jerry, modify the script as discussed with Johnathan, that should also fix your problem. Expect to see a new version of the script which will have this fixed.

  7. Thanks for doing this–new version works perfectly when I manually invoke it! I’m also trying to get this to work as a rule for incoming messages. I get this error message when the rule fires:

    While processing message „+test“ (ID 86013), the rule „Send to OmniFocus“ could not be successfully executed. The script encountered error „Microsoft Outlook got an error: sh: /Applications/Microsoft Office 2011//decoder: No such file or directory“ during execution.

    1. @johnathan it seems tha if the script is running as a filter then the current directory points to a different location. You can try and edit the script and point it to the full path for the decoder program. That should fix it.

  8. First of all, let me say THANK YOU! I have been looking for this ever since I started using Outlook 2011 and switching from Mail / iCal, the answer of „just use mail“ is no longer an option as the categories in Outlook are far more stable than MailTags ever was.

    Now the problem when i tried your instructions i get the following error : Microsoft Outlook got an Error: MIME::Body::File->open ./msg-5922-1.txt: Permission denied at MIME/Body.pm line 435.

    Any ideas?

    1. @John, that is very strange, the thing is that the file should be saved as something like /tmp/entourageXXX.eml but the error leads me to believe that its saving it somewhere ./msg-5922-1.txt which is very strange. Have you modified the script?

  9. @rainer
    I modified the script with the full path as follows but still get the same error when invoked with a rule. Did I miss something?

    set theTxtContent to do shell script „‚“ & workingDir & „~/Documents/Microsoft User Data/Outlook Script Menu Items/decoder‘ < " & theFileName

    1. @Johnathan, the line should look like this
      set theTxtContent to do shell script “‘~/Documents/Microsoft User Data/Outlook Script Menu Items/decoder’ < " & theFileName

      Actually, I think I will modify the script like this anyway (new version) since this would be the best solution.

  10. Me thinks I’ll wait for the Master to roll out a new version…“Edit“ and „Script“ don’t go together for me, really…question, why do you not have a way to donate for your efforts? I, for one, would contribute. This is hugely helpful for me in my everyday life.

    Thanks again for your help.

  11. My main problem with the script is it puts TONS of files in the / of the hard disk. Is there a way to prevent this? Like all the emails and attachments get copied there. I have removed them manually but they keep piling up as I use the script.

  12. So, what happens is I end up with files like msg-6638-1.txt in my / of my hard disk. I have not modified the latest script, except to comment out the decoder.pl routine and comment the decoder routine. If I manually do like so:

    echo foobar > foo
    perl decoder.pl < foo

    (I am doing this inside my Outlook script items folder), then it generates the msg-6638-1.txt file in that directory. When I run the script via Outlook, it generates these files in the root of my hard disk.

    The issue is, they are not cleaned up. Any ideas?

  13. @rainer
    I’ll wait for your new version 😉
    I ended up with: The script encountered error „Microsoft Outlook got an error: sh: -c: line 0: unexpected EOF while looking for matching `“
    sh: -c: line 1: syntax error: unexpected end of file“ during execution.

  14. I had permissions problems with the temporary files created by ‚decoder‘ in the Outlook Scripts folder. Returned something that looked like an error opening the temp file in the MIME module.

    This change to the .scpt did the trick:
    set theTxtContent to do shell script „(cd /tmp; ‚“ & workingDir & „/decoder‘ < " & theFileName & ")"

  15. I’ve noticed that attachments (say a pdf I want to read later) get added at an outlook email attachment (entourageXXXXX.eml). Any thoughts on how to get the original attachments?

  16. Thanx!! I will try the. I am a bit confused with the versions. Could you post a like to the one you recommend me to use?

    PS:
    The machine I am installing the script is set up with two users. Will that cause a problem?

    Again, thank your for this!!

  17. I’m complete novice in Terminal Trying to perform chmod a+x
    decoder for Outlook On entering „/Out“ I get: Tim$ cd
    Documents//Microsoft User Data//Outlook S Help !

  18. Version 4 and HTML messages…
    Plain text messages come over just fine.
    When the message is in HTML, all I see is the HTML code.
    Is this normal?

    PS As others have said – thank you so much for your work on this!

  19. Excellent script – but what can I do to tweak the script so that the focus remains with Outlook instead of switching to Omnifocus? I’ve tried commenting out the last bit in the script that appears to swtich focus to OF, but that didn’t seem to have any affect. I’m not exactly well-versed with apple scripting so I may have bungled that effort.

    I much prefer to stay in Outlook and clean up my Omnifocus inbox at a later time.

    Thanks for the great support!

  20. Just installed the script in used the installed instructions. I have a usage help question. Sorry if I am redundant here.

    Anyway, my question is: when I open a mail item from Outlook 2011, I right click and I have the menu item OmniFocus: Send to Inbox. When I do that the OF entry does not include a link back to the original mail item.

    what am I missing here

    1. Hi Stephan. It sounds to me as if you are not using my script. You use my script in the following way:
      1. highlight the message in the message overview
      2. open the script items menu (in the menubar, the menu farthest to the right that has the little scroll type icon without any text)
      3. select „[OF] SendOutlookToOmniFocus“. Alternatively you can also just hit CTRL+o without opening the menu.

      I am not sure where you got the right click menu item from but maybe you have something else installed as well.

      If you do it as described you will get an omnifocus action with the subject of the email as the title and the body along with a link (on the very bottom).

Schreibe einen Kommentar

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