DEVONthink and Hazel

May 2021 Update
DEVONthink support gives a great way to achieve same without relying on Hazel.

The purpose of this document is to outline in general terms how we use capabilities of Hazel and DEVONthink, in tandem, to automate the process of getting files into DEVONthink and then processed (where possible and implemented).  

We use Hazel for what Hazel is good at. We don’t try to make DEVONthink do what Hazel does well. We let DEVONthink do things related to DEVONthink.

There is no use of Apple Script in this process. Certainly Apple Script could be used, but because Apple Script is OSX-specific and that I can’t be bothered learning yet another computer language I avoid Apple Script when it’s not really needed to meet my needs. Other people’s skills and needs are perhaps different. 

Global Inbox

DEVONthink has a so-called “Global Inbox” folder to which it looks to automatically import into the Global Inbox when files appear there.

This screen shot from Page 8 of User Manual for DEVONthink 3.6.1.  All other references to the DEVONthink User Manual is to this document available from

https://www.devontechnologies.com/support/download/extras.

GlobalInboxDescribed

Page 128 describes how to turn this on and create this folder.  This folder is buried in the file system, but is displayed in OSX’s Finder simply as “Inbox” after it is installed via the “Install Add-Ons” menu in DEVONthink.  The Global Inbox folder is located in:

/Users/XXX/Library/Application Support/DEVONthink 3/Inbox

Where XXX is the user’s login name.

Anything dropped into this folder, manually or by automated process, gets eventually imported into DEVONthink.

For more information on the Global Inbox, see the DEVONthink User Manual.

Making the Global Inbox Work

As mentioned above, the Global Inbox Folder in the Finder’s sidebar and is simply “Inbox”.  Sometimes I forget that that folder means when I want to put a file there for automatic import into DEVONthink.  

I also want to make it easy for me to add files to DEVONthink from whatever device (IOS or OSX) I may be using. This DEVONthink folder resides on one machine and not easily accessible by other devices. 

This is not a full explanation of how we use Hazel, DEVONthink, or other apps we have in our workflow for reading, learning, and writing (occasionally).

To make this happen I use Dropbox which runs on all my devices to sync files.  Most all the files and folders that I work on are in the Dropbox folder so it’s a “universal” file location for me accessible by all devices.  Dropbox automatically takes care of the synchronisation of all so-called Dropbox files across all of my devices.  

For sure other synchronisation products and applications could be used, but I’ve not bothered trying as Dropbox works well.

In the Dropbox folder I create a special folder called “2DEVONthink”.  See that folder in Finder, along with “Inbox” in the following screen shot of my Finder.  I put a “2” at the front of the folder so that it shows up near the top of an alphabetic list of folders (in Finder in OSX or Files in IOS), and I put “DEVONthink” in the name to make it be what it is. I did not add “Inbox” to the folder name as it makes it too long and redundant anyway.

FinderWindow1

Anything dropped into this folder, manually or by automated process, gets eventually imported into DEVONthink.

Now how do we make it useful?  We use Hazel (https://www.noodlesoft.com) quite a lot. From their User Manual:

Hazel Overview

We setup Hazel to “watch” the “2DEVONthink” folder and when anything appears it moves it into the designated DEVONthink Global Inbox folder on that machine (see “Global Inbox”).

By making a Hazel rule (which runs on a desktop iMac which is usually always running (or sleeping) and connected to the internal and external network, it can act automatically on my behalf to move an incoming file (via Dropbox) into the DEVONthink folder, and then if DEVONthink running, or when it does run, it imports all the files it sees in it’s Global Inbox folder.

Hazel 2DEVONthink Rule

Using 2DEVONthink in Real Life

This folder becomes the one place I put all files that are destined to DEVONthink.  I just drag and drop from where they are, or “File/Save As …”.  There are of course many ways to get files into DEVONthink which are well covered starting on Page 48 of the DEVONthink User Manual. 

What’s nice about using this approach is that once DEVONthink “imports” the file into it’s Global Inbox, then we can use DEVONthink’s Rule Engine to automatically do things for me.  All “incoming” with this method will be trigger the Rule Engine’s “Perform the following actions” then picking “Import”.

Related: Pre-analysis on Incoming

For some files I like to give them good “stand-alone” names which succinctly describe the contents. Files have to “stand-alone” regardless of what file folder, DEVONthink “group”, or whatever they reside in. I use Hazel to pre-process some of these rules.

Look again at the Finder Window in “Making the Global Inbox Work” and notice the folder “Scanner Input”. 

This is the folder to which I direct output from Scanner and where I drag/drop files which I want handled like scanned files, e.g bank statements, invoices, bills, etc. Things that I can figure out the pattern based on content and then adjust the file name before sending on to DEVONthink. 

Again Hazel comes into it’s own here as it has very sophisticated technology handle files based on user-defined rules.

We setup (numerous) rules watching “Scanner Output” for files matching patterns. Once the pattern is recognised, then we direct the file to it’s intended destination.Often that destination is DEVONthink, so we simply tell Hazel to move the file into the 2DEVONthink folder. Some of the rules direct files to another folder, and some of those folders are “indexed” by DEVONThink.

RMSLtd Rule

Notice in the above example we are using Hazel’s capability recognise date formats, assign dates to variable names, text into variable names, and then use those variables in the actions.  See the Hazel User manual for more information on how to do that.

Here is another example of importing AMEX monthly statements.  Our standard format for a lot of scanned documents is to prefix the filename with a date/time stamp of the form YYYYMMDDHHMMSS to make sorting in Finder and DEVONthink simple. Clearly for a statement of this sort the time part of the date/time stamp is irrelevant so we just flesh it out with six zeros.  Could have ignored it, but that’s not how we did it and we leave the Hazel rule alone.

HazelImportAMEXStmt

In summary, we use Hazel for what Hazel is good at. We don’t try to make DEVONthink do what Hazel does well.  We let DEVONthink do things related to DEVONthink.

Types of Rules used “On Import”

Once the file hits DEVONthink’s Global Inbox, we have a number of rules setup to process those files. DEVONthink has some sort of queuing process setup to do things in order and one at a time. We don’t need to “schedule” these rules to fire at intervals or at any particular time. We just tell DEVONthink to do things “on import” trigger.

Some of the rules we have setup to fire “on import” are:

  • Convert PNG and JPG files into one-page PDFs
  • Convert all HTML files into multi-page PDFs
  • Convert Web Archive files into PDF
  • OCR anything not already OCR’ed
  • Classify (this one works better and better as time goes on)

Postscript

This document was composed using Scrivener (https://www.literatureandlatte.com/scrivener/overview), my favorite tool for writing. It was compiled into a simple PDF format. The Scrivener files are NOT in DEVONthink but in the folder where I keep all the Scrivener writing projects. The “finished” PDF is stored in DEVONthink.

Comments are closed.