planetwater

ground- water, geo- statistics, environmental- engineering, earth- science

automation: getting papers into papersapp from OmniFocus tasks

without comments

I am using OmniFocus to organize my life and in an attempt to get a few things done. My academic live also involves staying on top of publications. I rely on papers as my reference manager. In the last little while, I used OmniFocus to keep track of the papers that I found and that I wanted to get and / or read. This has been a quite reliable workflow, but involved quite some manual clicking.

OF papers

This post describes how I improved it with a little applescript to go more directly from OmniFocus to papers:

  • whenever I see a paper that interests me, I capture it into OmniFocus;
    • the title of the task is the title of the paper or whatever else helps me to identify the paper;
    • the note contains the URL to the pdf of the paper, and nothing else;
    • the task gets assigned one particular project, whose sole purpose is to collect papers I want to get / download;
    • the capturing works mostly via Omni’s “clipotron“, the share sheet extension in iOS, or from within Reeder;
  • regularly, I check that project (on its review date) and get the papers. Until very recently, this involved a few steps for each paper: open the note in OF, click on the link, the relevant page would open in Safari, and I would klick on the bookmark tool that I had setup such that this webpage would open in papers. I replaced this with a very simple applescript (see code listing below)
    • make sure that I am connected to the University’s network to ensure that most papers are accessible;
    • select the perspective that focusses on the project that contains the papers I want to get;
    • select the papers that I want to get, hit a keyboard shortcut associated to the applescript in Keyboard Maestro;
    • tada! papers opens the links, tries to retrieve the pdf (which works in most of the cases) and the bibliographic information. All is left for me is to add some meta-data and read;

Below you can find a listing of the applescript code. It is fairly simple and contains only a few lines. I can see a few areas where it could be expanded (parse URL from note if it contains more stuff than just the URL; what if pdf and / or bibliographic information can not be retrieved by papers). But for most of my use cases it works remarkably well. Hence, I would well agree to John D. Cook’s line of thought that yes, it’s a bit about time being saved, and it’s also about not being derailed. It’s also about accuracy (as followed up by Dr. Drang), and about knowledge transfer and improved processes, as Mike Croucher points out.

Here’s the code snippet:

tell application "OmniFocus"
    -- Target the content of the front window
    tell content of front window

    -- get selected entries
    set theTasks to value of every selected tree

    -- loop over each selected task
    repeat with aTask in theTasks

        tell aTask
            -- extract the task name and the note
            -- note contains URL
            set theTaskName to name
            set theNote to note

            display dialog theNote

            -- open in papers; it automatically retrieves the pdf and 
            ---    the bibliographic information (mostly)
            tell application "Papers"
                open location theNote
            end tell
        end tell

    end repeat
end tell

end tell

Relevant links regarding applescript with the two main software packages used:

Written by Claus

December 30th, 2015 at 10:39 am

Posted in