Outlook to Omnifocus take 3

This is another update to the previous releases of my Outlook script. The main changes are

  • no more use of perl
  • much smaller file size
  • uses java now (requires java6)
  • handles arbitrary encodings (even russian)

Install instructions:

  1. Double click the OutlookToOmniFocus-v4.tar.gz to extract it
  2. 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“.
  3. that’s it

Usage instructions (Updated 2010-11-03):

  1. select a mail in outlook
  2. open the script menu and choose  „Send Outlook to Omnifocus“ (see screenshot) or alternatively just press CTRL+O (o, not zero)

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.

Download

Download the file here: OutlookToOmniFocus-v4.tar.gz

Update 5.11.2010

If you have a non-english system then your „Microsoft User Data“ folder might use a different localized name. In this case please replace „Microsoft User Data“ with the correct folder name (e.b. „Microsoft-Benutzerdaten“ if you are using a german system). Thanks to Jens for pointing this out.

Update 15.02.2011

Please check out the latest version here:

http://rainer.4950.net/wordpress/blog/2011/02/15/outlook-to-omnifocus-take-4

77 Gedanken zu „Outlook to Omnifocus take 3“

  1. Hey,

    I just wanted to thank you for this fantastic script. I moved to the Mac platform just over a year ago and love almost everything about it. One of the few things that disappoints me is Mail – to be honest out of the box it’s just complete fail. Throw in some 3rd party additions like MailTags & MailActOn and it becomes semi usable.

    Still it’s a long way short of what I want a mail client to be to support the ever increasing demands of my work schedule. Consequently I just bought Office 2011 for Mac and I’m loving the new suite. Outlook in particular is great and having an option to clip into OmniFocus, an application I simply could not work without, is fantastic.

    Stellar job, much appreciated.

  2. Perfect–thanks for doing this! One quick comment–had to move the script out of the subfolder after unzipping and save it as an Applescript bundle so Outlook would see it. The original script file format in the Zip works as a mailbox rule.

  3. Please disregard my previous comments from the old version, this version seems to work perfectly! Thank you so much, everything works as advertised.

  4. One additional request if you have time…would it be possible to have the Omnifocus Inbox with the new task automatically be saved? That would allow it to work unattended (i.e.., without the need to manually save the new task that’s added to the OF Inbox.)

    1. havent tried this but you could try

      tell application "OmniFocus"
      set theDoc to default document
      set theTask to theName
      set theNote to theTxtContent
      tell the first document
      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
      ...

  5. @rainer
    Thanks–tried the new lines but got some error messages.

    Is there an AppleScript step that will „click“ the Save button in the Omnifocus Inbox window after it activates with the last section of your script?

      1. ok, try this, for me this works

        tell the first document
        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

  6. I get a syntax error when I compile it but I may be putting it in the wrong place…do these new lines replace the section of the script that’s commented:

    –set theTxtContent to (contents of theOutFile)

    ?

  7. I so appreciate this script being developed as I have become dependent on it to move items from mail to omnifocus. Unfortunately, I don’t know what I am doing wrong but I cannot get this to work. I have been following the directions as listed and keep getting an error message.
    Any suggestions on what I can/should do (detailed, please) to make this work????
    Thank you so much for your help!

  8. I installed the script per your instructions and it doesn’t seem to work. Clipings works great with Mail (as it did before), but nothing happens with Outlook. What am I doing wrong?

  9. When I try to run it from the scripts I get the following script error:

    Microsoft Outlook got an error: Unable to acess jarfile /users/……(my name)…/documents/microsoft user data/outlook script menu items/mailDecoder.jar

    Any suggestions on what I should try?

    1. @Adam, copy the path, open terminal and do
      ls <whatever you have copied before>
      if the file is not there, then you have a problem with your path, check the spelling. You can then do a ls /Use<tab>/<youruser><tab>/…<tab>
      etc until you are in the correct directory. Compare the 2 paths.

          1. First of all: A big thank you to Rainer for preparing the script so soon after the Office 2011 launch!

            The script error occurs Adam saw because the Office installation uses local language folder names. Within the script, Rainer uses „Microsoft User Data“. Which, at least when upgrading an older Office Version to 2011, is with german language OS X or Office installations „Microsoft-Benutzerdaten“.

          2. Am I having the same error as Adam? :

            Microsoft Outlook got an error: Exception in thread „main“ java.lang.UnsupportedClassVersionError: Bad version number in .class file
            at java.lang.ClassLoader.defineClass1(Native Method)

          3. @Jonathan, try opening terminal and type „java -version“ and find out which version of java you are running, also do „which java“ to find out where the java binary is that is actually being used. It still looks to me as if you are running java5, rather than java6.

          4. Thanks for the help…

            This doesn’t look good. Even though Software Update says all is fine and the Java Preferences show J2SE 5 & 6 the terminal command brings back the following:

            Exception in thread „main“ java.lang.NoClassDefFoundError: version
            Caused by: java.lang.ClassNotFoundException: version at java.net. URLClassLoader$1.run (URLClassLoader.java:202) at java.security.AccessController.doPrivileged (Native Method) at
            ect.. ect.. on for a few more lines.

            Guess I’m screwed? I’ve heard the only way to recover Java correctly is for a total OS re-install. Please say it isn’t so…

          5. @Jonathan, yep, thats not good at all, you can try and compare with a second mac how your $PATH, your $JAVA_HOME and the folder structure is set up. When I type which java I get
            /usr/bin/java
            Then when I do
            ls -ls /usr/bin/java
            I get
            /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
            Finally

            cd /System/Library/Frameworks/JavaVM.framework/Versions/
            ls -la

            yields
            drwxr-xr-x 13 root wheel 442 23 Okt 18:50 .
            drwxr-xr-x 12 root wheel 408 23 Okt 18:50 ..
            lrwxr-xr-x 1 root wheel 5 23 Okt 18:50 1.3 -> 1.3.1
            drwxr-xr-x 3 root wheel 102 12 Feb 2010 1.3.1
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.4 -> CurrentJDK
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.4.2 -> CurrentJDK
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.5 -> CurrentJDK
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.5.0 -> CurrentJDK
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.6 -> CurrentJDK
            lrwxr-xr-x 1 root wheel 10 23 Okt 18:50 1.6.0 -> CurrentJDK
            drwxr-xr-x 10 root wheel 340 23 Okt 18:50 A
            lrwxr-xr-x 1 root wheel 1 23 Okt 18:50 Current -> A
            lrwxr-xr-x 1 root wheel 59 23 Okt 18:50 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

            So my CurrentJDK points to 1.6.0 and Current points to the folder ‚A‘. Maybe that helps

      1. Hi, I am experiencing the same error as above „Unable to access jarfile /path/to/MailDecoder.jar“ I do not have a different language OSX. when I ls the directory in the error’s path, there is no MailDecoder.jar

        My java is correct version (determined as you recommended below for someone else with this problem):
        drwxr-xr-x 13 root wheel 442 Oct 29 10:30 .
        drwxr-xr-x 12 root wheel 408 Oct 29 10:30 ..
        lrwxr-xr-x 1 root wheel 5 Oct 29 10:27 1.3 -> 1.3.1
        drwxr-xr-x 3 root wheel 102 Feb 11 2010 1.3.1
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.4 -> CurrentJDK
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.4.2 -> CurrentJDK
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.5 -> CurrentJDK
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.5.0 -> CurrentJDK
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.6 -> CurrentJDK
        lrwxr-xr-x 1 root wheel 10 Oct 29 10:27 1.6.0 -> CurrentJDK
        drwxr-xr-x 10 root wheel 340 Oct 29 10:30 A
        lrwxr-xr-x 1 root wheel 1 Oct 29 10:27 Current -> A
        lrwxr-xr-x 1 root wheel 59 Oct 29 10:27 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

        I appreciate any guidance you can provide, I’d really love to be able to give this a try. Thanks!

        1. @bend, is this the actual error message? you need to make sure that the „/path/to/MailDecoder.jar“ is pointing to the correct directory. That should be something like „/Users/rainer/Documents/Microsoft User Data/Outlook Script Menu Items/MailDecoder.jar“. Take a look at the appescript and change it accordingly. I think the instructions should be properly noted, if in doubt read my previous posts tagged as „outlook“.

          1. Sorry for not being specific…The path on the actual error IS „/Users///Documents/Microsoft User Data/Outlook Script Menu Items/MailDecode.jar“

            theoretically it shouldn’t matter, but yes there are 2 forward slashes between the username and Documents.

          2. Is there really no username after /Users ? You can try to do
            ls „/Users/yourusername/…/MailDecoder.jar“
            In terminal and make sure that the file is found.

          3. @Bend, I just looked at my script again and there is nothing that you would need to do. It should work out of the box without modifications. If you want you can tweak the script by putting the following lines in
            set homeFolder to (path to home folder as text)
            set posixHome to (POSIX path of homeFolder)
            set mailDecoderLocation to """ & posixHome & "Documents/Microsoft User Data/Outlook Script Menu Items"/MailDecoder.jar"
            tell application "OmniFocus"
            log "mail decoder location " & mailDecoderLocation
            end tell
            -- set theTxtContent to do shell script """ & posixHome & "/Documents/Microsoft User Data/Outlook Script Menu Items"/decoder /tmp/out.txt"
            do shell script "java -jar " & mailDecoderLocation & " " & theFileName & " " & theOutFileName & " > /tmp/out.txt"

            search for the first and last line of this block and replace everything in between with the script in here. Then run the action (CTRL+O) and watch the console output. Then once you have the mail decoder location, copy that and open terminal and do
            ls -l
            and see if it finds the file. The path should definitely include your username, if thats not the case then there is something seriously wrong with your Mac OSX.

          4. …sigh…
            I don’t know why, but for whatever reason when I posted my previous post, it stripped out what I put in place of my actual username…

            The path being thrown in the error message is correct as compared to other posts on here, as well as what you are saying should be expected. The one exception is that there is a // after my username rather than just / …i.e.

            /Users/myusername//Documents/Microsoft User Data/Outlook Script Menu Items/MailDecoder.jar

            As mentioned before, I have already confirmed that this path does not include a ‚MailDecoder.jar‘ file. Am I correct in assuming that this .jar file is something that should be put there by outlook?

            I am anxious to see this work, and I greatly appreciate your help…and I’m sorry that my responses apparently haven’t been very clear.

            My Outlook build is 14.0.2 (101115)
            my OS X version is 10.6.6

  10. Hello I have installed your v5 version of the Apple Script. When I select a message and then press Control O or I select the script from the Outlook script menu I get the same error that says I must select a message first and then run the script. I have tried selecting the message in the inBox and I get the above error, so I opened the message and then tried to run the script, but I get the same error. I am sure its pilot error on my part, I wonder if you have any ideas what I have done wrong? Thank You.

    1. @Dave, I have no clue whats going wrong. Maybe there is a problem with your Outlook. I dont know. All I know is that outlook reports that you dont have any message selected. All I do is go to the inbox, click on a message and then use the script menu (or CTRL+O).

      1. I have tried all versions you have made of your script, but I still get the same error. It runs great on my Mac Pro but not on my MacBook Pro. I have also tried to access cd~/Documents/Microsoft User Data/Outlook Script Menu Items in Terminal but I get back the error „No such file or directory“ I am not familiar with Terminal commands, but maybe this is again Pilot error. I double checked the location of the Outlook Script Menu to make sure that was not the problem as you can see it seems to be correct „/Users/dpennells/Documents/Microsoft User Data/Outlook Script Menu Items“ Any ideas as I find it difficult to not be able to send Email messages to Omni Focus. Thank you so much for all your help on this and for your scripts.

          1. I am in Los Angeles (PST) I have run a couple of system repair programs. Since I completed that your script seems to working great. Thank you so much for writing these scripts and thank you for all your help.

          2. I am sorry, but right after I wrote my last message to you the same problem as I was having before started happening again. This is very strange!! The error message I get is an Outlook 2011 Message Box that contains the following message: „Please select one or more messages first and then run this script.“ Sorry, I thought this had fixed itself.

          3. Hi Rainer, Your script has been working great up until yesterday when I started to receive the following error: script error: microsoft outlook got an error: exception in thread „main“ java.lang.NullPointerException at com.burgstaller.mime.decoder.MailDecoder.main (MailDecoder.java:53)
            I have the latest build of Outlook 2011 Version 14.0.2 (101115)
            Any ideas on this one? Thank you as always

          4. Hi Dave, can you forward me the mail in question? There has to be something unexpected in it. It looks as if there is a part of the mail that does not have any content which would be a bit odd. Anyway, with the mail I can make the script more robust.

  11. I got the following message:
    current message kann nicht in Typ specifier umgewandelt werden
    current message cant be changed in type specifier

    Anny ideas

    Thanks in advance

  12. Not sure what I did differently today, but using v5 I finally got this to work. Thank you so much for getting this done. It is incredibly useful!!!!!

  13. @rainer,

    Thank fot your good work. Unfortunaly it seems not to work on my macbook os x 10.6 outlook 2011. Followed your steps.
    When using the script my nothing will happen and outlook 2011 freezes and needs a forced quit.

    Some else this problem or a solution ??

    thanx sander

  14. This is great… loaded version 5 and love it so far! NO problems. Honestly, a lot of people bash entourage, but I loved the project center and utilized it regularly. Now I need to get the Outlook categories to sync with OF categories instead of iCal categories/calendars, or is that already possible?

  15. Many thanks for this useful script, which integrates Office 11 to Omnifocus. I have successfully used your Entourage script previously.

    Thank you again

    All I need now is to find a way of getting Outlook calendar to integrate/synch properly with my other calendars to complete my GTD methodology with Office 11.

  16. @rainer,

    Thanks for your reply and good work in these.
    My setup =
    Os x 10.6.4
    outlook 2011 english
    version 14.0.0 (100825)
    omnifocus 1.8.1

    No errors, only when using the script outlook freezes and needs a forced quit.

    Sander

  17. Rainer, many thanks for your great script. It reallly helps me a lot to get the things done. Still I have two problems…
    (1) The shortcut CTRL-O doesn´t work. If I use it I always get the message: „Cannot execute the „send toOmnifocus“ action. An error occured during execution of the Apple script: Microsoft Putlook got an erreor: Can´t make display nam of sender of incoming message id xxxxx into type specifier.“ If I use the menu everything works.
    (2) After closing the OF quick entry I have to go back to Outlook manually. The system doesn´t go back automatically.

    These are no very big problems but the workflow is everytime slowed down.

    I use a german system an already swithced the pathname to „Micrososft-Benutzerdaten“

    Can you help me?

    Kindly
    Wolfgang

  18. I was able to get this working on my macbook pro. Now, however, I am using a „regular“ mac and cannot get it to work. I am using os 10.5.8 and keep getting java errors.
    Any suggestions?

  19. Dear Rainer, I have made two replacements 1. documents in Dokumente 2. Microsoft User Data in Microsoft-Benutzerdaten, but I always got the error „current messages kann nicht in Typ specifier umgewandelt werden“.
    Any ideas
    Thanks in advance
    M

  20. Sorry, it seems that I posted my comment in the wrong place. Here it is again,

    Thank you very much for this wonderful script. I used the 5th release and worked beautifully.
    I wonder if you could amaze us with another script to allow Outlook 2011 to receive and send return receipts. There was one available for Entourage, but it does not work with Outlook.
    I am ready to support your work. I will make a donation for the Outlook to Omnifocus script, and another one if the DNR for Outlook 2011 is developed.
    Thanks again for your time and your excellent work.

  21. I installed version 4 successfully. The message title shows as it should. With text messages I see the body of the e-mail correctly. However with HTML messages I only see a bunch of code in the body.

    Is this normal?

    Also, I see reference to the 5th release. Where can I find this?

    Thanks much for all your great work!

  22. I can’t thank you enough for the script on Omnifocus to Outlook. As a computer layperson it’s amazing to me how work like this is done.
    It’s even more amazing that the person who does such important work shares it with others.
    Thanks Rainer!

  23. When installing the script I do not see the script added under outlooks apple script menu. If I highlight an email and then go into the apple script folder and double click the script the e mail is added to omnifocus. What am I doing wrong? I am running the trial version of MS office for mac 2011.
    Thanks for your help

    1. @Philip, please review all posts regarding this topic, I believe I had some install instructions in earlier posts. Basically you open outlook, click on the script menu, then choose „About this menu“ and then open the folder from there. Then drag the contents of the zip file in there.

  24. A coworker pointed me to this script as they were getting some errors on messages with no subject line. I added the following code to check for a blank subject line:

    set theName to subject of theMessage
    — Check for a blank subject line
    if theName is missing value then
    set theName to „No Subject“
    end if
    — End check

    This is a great script. Thanks for writing it!

  25. Love the script- thanks- (2) quick questions (1) How can i modify the script to not copy over the email file as an attachment and (2) How can the script be modified to link to the original email?
    Thanks for your help

  26. You are a complete GEM! Thank you for this script. I’ve also set up a rule in outlook that runs the script when the subject starts with „–„. It works like a dream.

Schreibe einen Kommentar

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