Outlook to Omnifocus2 – take 12

Cursor_and_Searching__Drafts_

This is the 12th installment of my little OmniFocus script which will turn Emails into tasks. This version has only been tested with the release version of OmniFocus2. It will most likely not work with OmniFocus 1. For OF1 please use the latest version here.

Changes:

  • Corrected file extension of generated email to (.eml) as suggested by Adam (thanks a lot)

Features:

  • fix for empty subject lines (provided by Paul and Peter)
  • added mail headers (from, date) to content of the note (provided by Paul)
  • does not rely on a separate jar tool anymore and should therefore be more compatible with older Mac OS versions. (courtesy of someone on the omnifocus forums whos name I forgot unfortunately)
  • configuration options
    • delete mail after turning it to an omnifocus task
    • target mail folder for moving the processed mail (note that this does not work in combination with mail deletion, please choose either delete or move)
    • bring omnifocus to the front
    • put cursor into a specific field in the quick entry panel
    • open quick entry panel (or just add the task silently to inbox)

Install instructions:

  1. Double click the zip file 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”. Update: on the latest version of Outlook this location is now <userhome>(Library/Applications Support/Microsoft/Office/Outlook Script Menu Items (thanks Mike for noting that)
  3. that’s it

Note to non-english office users:

Your Outlook Script Menu Items folder is in a different location. Please go the route via „About this menu“ explained in point 2!

Usage instructions:

  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)

Configuration instructions:

So if you want to tweak the settings of the script, bring up the file in the outlook menu items folder and double click it.

This will open AppleScript editor (if it does not, then you can try right click and choose Open with…). In applescript editor you will see a configuration block on the top of the file. Change the values as documented in the script, save it and you should be fine.

Note that a few settings rely on other settings to be configured (i.e. currently omnifocus activation will only be invoked if the quick entry panel is switched on). If you find those restrictions too cumbersome, let me know and I will look into that.

Download

SendOutlookToOmniFocus2-v12.zip

FAQ

Q: When I click on the email in Omnifocus2 then TextEdit (or some other mail program) opens, what should I do?

The problem is that the script will save the file with a „.elm“ file extension. Most often this extension is not registered with Outlook. So once TextEdit opens, copy the file to your desktop. Then Open the Info Panel (CMD-I) and then choose „Open With…“ -> Outlook. Finally click „Change all..“.

Q: I am getting weird errors (Omnifocus got an error: Can’t get <FCDo>). Whats wrong?

Looks like you have the standard version of Omnifocus2. In order for applescript to work you need the pro version.

Q: I am getting errors where Outlook is stating that the email is broken?

My current theory is that this will typically only happen on app store versions. Please post your findings in the comments so that we can learn a bit more about this problem.

69 Gedanken zu „Outlook to Omnifocus2 – take 12“

  1. Hi,

    Doesn’t the script enable link back to the emails (from omnifocus to outlook) making it easy to respond while processing emails?

    Pls, Pls, add this feature..it will be of great help

    Best,
    Collin

  2. Collin,

    This feature is already in the script. If you open the „notes“ field for the item created in OF, you’ll note a file represented by a small envelope icon at the top of the note. Double-click that file, and a copy of the original email will open within Outlook.

    Best regards,

    Adam

    1. Hi Adam,

      I don’t see the envelope in the notes section as you suggested. Do i need to enable/do anything in the script. Am using Mac Outlook 2011 & OF2.

      This is so important and i want to quickly get this working. Is there way i can reach out to you on the phone may be?

      Regards,
      Collin

      1. @Collin, no you should not need to do anything. The icon should usually show up just fine. If it doesn’t it should still show the title of the email in the first line (note that you need to expand the comments field (the little triangle) to see this.

        1. @Rainer,

          The issue is not identifying but linking it back to original email while processing.

          Now i have do the email title search in outlook to bring up the email so that i can reply.

          I get loads of emails and it would be so simple to be able to link back while processing the email.

          Shall appreicate any help available to make this possible

          1. @Collin the script already does that. It creates a link in the task that (when double clicked) opens the original email. At least thats what it should do. Can you provide a screenshot of how the newly created task looks? You can mail to rainer at 4950 dot net

          2. Hi Rainer,

            I have sent you the email with the screenshot and look forward to your response

            Regards,
            Collin

          3. @Colin, I seem to have problems with the 4950 account, can you please send it again to rburgst at gmail dot com? Sorry for the inconvenience.

          4. Hi Rainer,

            I have sent the email on your gmail id. Kindly acknowledge receipt and let me know your number to call you on. Shall appreciate your kind support.

            Best,
            Collin

          5. Hi Rainer,
            My Mac just had some hardware issue due to which i had to format, reinstall OS and Office 2011 for MAC. I then downloaded the script again and guess what i now see the message link and its working fine.

            However it opens the quick entry instead of just putting the mail in the OF Inbox. I normally prefer to process the emails in the OF Inbox. Any suggestion?

            Again thank you for all your help

            Best,
            Collin

          6. @Colin you need to update the script yourself if you want to change the parameters. The very first configuration option is

            -- here we specify if we want the quick entry pane (1) or not (0)
            property showQuickEntry : 1

            Just set this to 0 and the quick entry panel should no longer open.

  3. Very nice work on this script!

    I am attempting to adjust some properties.

    When I open the file in AppleScript, make my change (change „property attachMailToOFTask : 1“ to „0“), hit „compile“ I get the error:

    „Syntax Error – Expected end of line, etc. but found identifier.“

    The last word of this bit of code is highlighted:

    tell application „Microsoft Outlook“
    — get the currently selected message or messages
    set selectedMessages to current messages

    I’d like to make some adjustments, but can’t move forward unless I can compile this script.

    Any ideas?

    1. @Bill, I have this problem occasionally. IMHO the applescript editor has a few problems. The way I solve this is by opening the script in Text Edit (TextMate). There you can see class assignments for these statements that cause problems otherwise. Somehow AppleScript Editor strips those away and then forgets about the types which causes parsing errors. Anyway, once you copy paste the clear text back into applescript editor it should work again.

  4. Hi Adam,

    I don’t see the envelope in the notes section as you suggested. Do i need to enable/do anything in the script. Am using Mac Outlook 2011 & OF2.

    This is so important and i want to quickly get this working. Is there way i can reach out to you on the phone may be?

    Regards,
    Collin

  5. Collin,

    Rainer is actually the one who developed the script, I simply tinkered a bit until I was able to revive the link-back functionality that was in the original version once I migrated to OF2. However, the version he’s posted here successfully does that. As he said further up the comment thread, double-clicking the attachment in the notes field should re-open the message in Outlook (it does for me).

    I think he suggested posting a screenshot of what you’re seeing; perhaps if you did that, it would lead to a solution to your issue.

    Best regards,

    Adam

  6. Rainer,

    Ran into a truly strange scenario this afternoon. I’m trying to adjust the property to allow the script to automatically move the message upon initiation to a mail folder called „003 Omnifocus“. I edit the script in the Applescript Editor, changing the property from „0“ to „1“ and the folder name from „Test“ to „003 Omnifocus“ and then recompile. and save the script. If I then run it from the Editor window, it performs as expected – the message gets moved. If I then close the Editor and try to run it from the keyboard command in Outlook, the message doesn’t get moved. I then re-opened the script in Applescript Editor and found that the property and folder have reverted to their original settings – „0“ and „Test“!!

    Seeing an earlier message in this thread, I tried cooing and pasting the contents of the script from the Applescript Editor to TextEdit, making the revision there, and copying it back, but that didn’t work. I even tried making the change, then duplicating the script, closing the original and renaming the new one so that it overwrote the original, but that don’t work either.

    Any idea how to solve this?

    Thanks,

    Adam

    1. @Adam, are you sure that you are editing the correct version of the script? I usually export the script as a Script bundle (.scptd). It sounds to me that the original script bundle is still there and is being used rather than the updated one.

    2. @Adam – The issue is the permissions. This drove me nuts for quite a while. The first thing I checked was the permissions on the main file, but it’s the script file within the package that is the culprit.

      Right click on the file, click „open package contents“, browse to the script file and change your user’s permissions to Read+Write. After you do that you can edit the main script.

  7. I just tried the newest version of the script with OF Pro 2.0.1 and Outlook for Mac 2011. Outlook gives me an error:
    Script error-Microsoft Outlook got an error. An error has occurred.

    Any suggestions?
    Thanks!

    1. Can you check your Console and see if there is any further information there? Did it work before? If yes, what was different?

    2. I had this same problem with v12; I ‚downgraded‘ to v11 and it works fine.
      So, maybe some new bug was introduced in the v12?
      Keep up the good work

  8. Hi Rainer – just wanted to say thanks for developing this invaluable script. Seems to be working fine on my Outlook 2011 SP1 and Omnifocus Pro 2.02 test. Particularly love the ability to open the original email in Outlook with a double-click on the envelope icon.

    Cheers

    Julian

  9. Rainer,
    Thank you for your script. It’s an important part of my workflow.

    I’m testing Yosemite and when I launch your script in Outlook, everything initially works fine. However, in OmniFocus 2, when I select the message, I receive the error „OutlookMsg2173431.olk14_message“ is damaged and can’t be opened. You should move it to the Trash.

    -with an option to cancel or Move to Trash

    I edited the script and replaced „.olk14message“ with „.eml“ and don’t receive the error message but the link back takes me to whichever message is already selected in Outlook. Once I close the script editor, the „.eml“ change will not keep and I’m back to the previously mentioned error.

    1. @Mark, this is a problem of the AppStore version of OmniFocus (unfortunately). I am not sure how to work around this. The script changes might have vanished since you need to overwrite the original file. Make sure that you use the Export option in AppleScript editor and confirm that your changes are still in the correct file (at least this is all I can think of for now).

  10. Thanks for the OF2 script! Much appreciated.

    Like Collin, I was confused about linking back to Outlook but it’s a very subtle icon (see screenshot below).

    Also, it’s actually a copy of the .eml file and doesn’t link directly to the one in Outlook.

    Additionally, you’ll have to change the default app of .eml files if you notice it’s opening in another app other than Outlook. It was opening up in Mail for me instead out Outlook so I had to Right-Click > Reveal in Finder > Inspect the file > Uncheck Lock > Change default app to Outlook > Change All > Lock File

    https://www.evernote.com/shard/s10/sh/28ed898a-9322-40ba-b0b4-a5248340e079/0187cd685187ef89e878fbd3494a52b5/deep/0/Inbox.png

  11. Hi Rainer, thanks very much for this really helpful script. Are yo considering to work with Outlook 2015? I’m still running your script but with the lines to make the linked file commented out since otherwise it won’t run.

    Thanks – Steve.

  12. Dear Rainer,
    I have downloaded your script, moved it into Outlook script directory and executed it. I can see at the top of the screen a wheel for a few seconds (I suppose its the script working). The problem is that nothing gets to omnifocus. like it is this not working.
    Do you have any suggestion?
    Thank you very much for your work

  13. I was just working with someone on this with OL 2015, and we got it working with a non-Sandboxed version of OmniFocus. I changed the temp file storage path to point to ‚~/Library/Containers/com.microsoft.Outlook/Data/Documents/‘ as the parent folder. That way it’s already in Outlooks sandbox realm. To run it effectively, I made an alias (symlink would probably work, too) of the script from the Outlook scripts folder into ‚~/Library/Scripts/Applications/Microsoft/Outlook/‘ and set it up with a hotkey in FastScripts. Works great.

    1. Hi Brett,

      Really glad to hear you got the Attached Email functionality to work with OL 2015.

      Would you mind sharing the updated script? I’ve tried making the path changes you mentioned, but it’s still throwing an error on
      save theMessage in theFileName

      I also didn’t really follow what you meant by ’non-Sandboxed version of Omnifocus‘, or what the alias bit did.

      Any help you (or anyone else that’s smarter than me and got this to work) can offer would be appreciated.

      @Rainer – Thank you very much for putting this script together! I’ve been using it for ages and it’s a critical part of my workflow. I feel quite lost with it not fully working in my OL’15…

  14. Hello
    I am using Yosemite 10.10.1. and Outlook V15.3
    I get the message „Please, select one or more messages and then run this script“. Any idea on how to fix this?
    Thank you and sorry if it is a silly question

  15. Thanks so much for this awesome script. It solves a problem I’ve had with ever other task manager that I’ve ever used.

    Quick question…I’m trying to do the tweak about sending a copy of the message to another folder. This is because I dump a lot of stuff into my deleted folder and I want to keep it clean while not having to go through and pick out all the ones that are attached to an OF task.

    When I try to input the folder info (OF Email) I keep getting error messages. Is there a particular format that this folder needs to be in?

  16. I needed to make the same changes as Brett and thought I might as well share the script here for others to use:
    https://www.dropbox.com/s/og7ysjf7mc85kx1/Outlook2015-2-OmniFocus.scpt?dl=0

    – uses ‘~/Library/Containers/com.microsoft.Outlook/Data/Documents/’ for temporary file storage (dynamically determined)
    – works triggered via FastScripts or BetterTouchTool and doesn’t give the „Select messages first“ error for me

    Can anyone try this with OmniFocus installed via MAS?

    This finally makes Outlook 2015 usable for me … Thanks Brett for the hint wrt the sandbox realm!

  17. I’m extremely interested in the script to move messages from outlook 2015 to OF2 and I have the revised apple script from the dropbox link, but without a script menu in OL 2015, how do I action it?

  18. Thanks very much for this script – it works like a charm and has helped me adopt OF along with my workhorse Outlook.

    I wondered however, can anyone help me modifying the script such that it would rather tag the processed message with a given category like „Tracked in OF“ instead of the option to move / delete the processed message? I’m not an applescript native, so if someone would know how to get this done, that would be super helpful! Thanks.

  19. Hi Rainer,

    Excellent script; just what I needed to clear out my inboxes.

    One bug I found that many users probably won’t be troubled by is where multiple mailboxes exist with folders of the same name – if you want messages to be automatically moved, the folder selected may not be the one associated with the account the message is in.

    My fix is as follows. Add this line to set the account details towards the top of the script (I put mine in after setting theSender):

    set theAccount to account of theMessage

    Then make the line that moves the message:

    move theMessage to folder targetMailFolderName of theAccount

    This ensures that the folder is associated with the account that the mail is stored under – I have archive folders for each mailbox, all labelled ‚Archive‘.

    Once again, many thanks for your efforts.

  20. Hi Rainer,

    This is a great script and it works awesomely!
    Two questions:
    – Would it be possible to actually have a link to the original outlook email in the task instead of a copy of the email in the omnifocus task?
    – Is there a way to open the .eml file on iOS?

    Thanks, and keep up the great work,

  21. Hi, Is there a way to have it prompt which Outlook email folder I want to move the message to, after I’ve sent it to OmniFocus?

    Thanks

  22. Hi,

    I am using Outlook 15.11 at the moment. I read all postings, but I have no idea how I can install the script für OF2.

    Any hints?

  23. Hello!, i installed the script, but i dont know where is the „open the script menu and choose ”Send Outlook to Omnifocus” (see screenshot) or alternatively just press CTRL+O (o, not zero)“… if i open an email and select some text with the second boton (two fingers) in service i have an option „send to inbox omnofocus 2“ (something like that), but that all.. how can i send the entire email like a taks?

    1. @Gonzalo, as long as you have Outlook 2011 you have the script menu icon. Its the last menu after help. Its a graphical icon in the menu bar looking like a scroll.

        1. The outlook script uses applescript to do its job. Unless you have the pro version, apple scripting is disabled in OmniFocus.

          1. Sorry, but i cant understand… Pro version of what? cause i have the payd omnifocus (of2) and i dont know where i can get the „pro“ version of applescript….

  24. Hi Rainer,

    Thanks so much for this script. Huge fan and I’ve shared it with a bunch of coworkers.

    How can I customize the script so that rather than going to the Omnifocus2 Inbox, it always goes to a specific project?

    My ideal omnifocus setup is to send everything from Outlook to a „Work Inbox“ project, and then I can move, prioritize, do from there. Right now, everything is setting sent to the Inbox, which creates another step in the workflow. Is there a way to customize your script to accomplish this? I am using Outlook 2016 (v.15.11.2) and Omnifocus 2 Pro.

    thanks in advance for your help. much appreciated!

    1. @Sharad, the simplest solution for this is to enable the quick entry panel (See parameter definitions on the top of the script) and enable that, then you can at least move it directly in the entry panel.

      Otherwise you would need to hack the script in that line here to move it to another project.


      ...
      set NewTask to make new inbox task with properties {name:theTask, note:theTxtContent}
      ...

      You would need to first somehow look up the project and then figure out how to tell it in applescript to move it to that project.
      I fear this is a bit involved.

  25. I love your script. it worked great for me with outlook 2011. recently I upgraded to the new outlook 2015. now I often geht the error message „Please select one or more messages first and then run this script“. I start the script with „FastScript“ but also tried from normal script folder. any idea how to solve that? Thanks for your feedback in advanced.

    Thomas

  26. Hi there – this looks very promising for what I would like to do – should this work for the new Outlook for Mac ? I seem to hit a syntax error on „save theMessage in theFileName“ – sorry new to apple world … any suggestions greatly appreciated. Thanks

    1. @Howard Sorry, I don’t use the new Outlook. However, I did see a couple of comments (see other comments) from People who were using it successfully (although with some hiccups).

  27. Hi I’m using Outlook 2016 and I got an error message like:
    „Error Number: -2700 Microsoft Outlook got an error: An error has occurred.“
    Can you help?

  28. Hi, I’m running a Mac with Outlook 2016 and OF2. I’ve followed all in instructions but can’t get the script to run / work. In Outlook 2016 there is no script menu to run the script from and control + o doesn’t do anything.

    Does anyone have any ideas?

    Would greatly appreciate the help as this script is just what I have been looking for. Cheers Stu

Schreibe einen Kommentar

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