Using Hookmark with DEVONthink by DEVONtechnologies

Hookmark is a contextual information retrieval tool that links data from your favorite apps. So it’s no surprise that Hookmark should work well with DEVONthink, an information manager with advanced automation, filing and analysis. DEVONthink has legendary search and indexing capabilities. It lets you edit and annotate documents in place.

DEVONthink is also one of the best ways to sync all kinds of data across all your devices. In addition to many other benefits, DEVONthink’s sync ensures your data’s privacy.

Using Hookmark with DEVONthink

You can use all your favorite Hookmark commands and shortcuts in the context of the selected DEVONthink item. Just select or open an item in DEVONthink, and invoke Hookmark (using ⌘⇧SPACE, the menu bar icon or a Dock link) as you would in any other app. (See Getting Started).

For instance, you can select any item in DEVONthink and use these commands:

a. Hook to New… ⌃⌘N
b. “Hook to New <Default Note-Taking app> (⌘N) (For example, “Hook to New BBEdit”. The app shown in this command is configurable in the Notes Preferences tab)
c. Copy Link (⌘C)
d. Copy Markdown Link (⌘M)
e. Hook to Copied Link (⌘L/⌘V)
f. Reveal File in Finder (⌘R) (if the title item is a file)
g. Make Hookmark File (⇧⌘H)
h. Copy All Links (⇧⌃C) This copies all the links associated with the title bar item as shown in the Links section of the Hookmark window.

Linking (for example)

In particular, you can link to and from items in DEVONthink as you would in any other app:

  1. Open or select an item in DEVONthink.
  2. Invoke the Hookmark window (with ⌘⇧SPACE or other means) and use the “Copy as Link” command in Hookmark’s title bar menu (⌃T) or use ⌘C.
  3. Select or open a different item (in any compliant app, including DEVONthink).
  4. Invoke the Hookmark window again and select “Hook to Copied Link”(⌘L) in the title bar menu (⌃T).

That’s it. The two items are now linked! The next time you invoke the Hookmark window on one of the items, you will see a link to the other in the Hookmark window. To navigate between the two, just double-click on the link in the Hookmark window.

Copying and pasting URLs in DEVONthink

You can also paste URLs obtained from Hookmark “in line”, directly into DEVONthink items. For example, in a web browser (where you are presumably currently reading this document):

  1. Invoke Hookmark.
  2. Use the Copy Link or Copy Markdown Link function.

Then in any DEVONthink item, you can use DEVONthink’s own paste command to paste the hyperlink.

Hookmark is perhaps the most rapid way to get fully formatted links. What’s more, Hookmark’s Copy Link function is a uniform gesture you can use on files and objects from a huge variety of apps.

This means that you can now paste links to all kinds of items in DEVONthink items, such as:

  • emails (Apple Mail, MailMate, AirMail)
  • OmniFocus or Things tasks
  • TaskPaper and all kinds of files
  • DEVONthink items
  • documents in Drafts, Bear, nvUltra, nvALT, and so much more

Using Hookmark’s Hook to New with DEVONthink

When you use Hookmark’s Hook to New… (⌃⌘N) function (whether in the context of an item that is inside or out of DEVONthink), you can choose DEVONthink as the new item type. This will:

  1. Create a new empty plain text document in DEVONthink’s global inbox.
  2. Name it according to Hookmark’s general naming rules (based on the name of the current item).
  3. Link it to the current item. (“Current item”, as usual, means the context in which you invoke Hookmark, such as an email message, a selected file in Finder, an open file in some app, or an open item in a database style app, such as an OmniFocus task.)
  4. Open it in DEVONthink.

So, your new items will have all the benefits of being in DEVONthink while also being bidirectionally linked to their context. Cool!

Hook to New DEVONthink markdown document

If you’d like to “hook” items to a new DEVONthink file containing a backlink to the original item, try this script.

Using external apps to view/edit files that are stored in DEVONthink

This section is a bit technical. You only need to read it if you tend to open DEVONthink items with apps that are external to DEVONthink, like Preview.

The bottom line is that exposing the Hookmark window on an item in DEVONthink shows you all and only the links you forged with Hookmark on the item inside DEVONthink. If you open the item in an external app, like Preview, you will not see those links; and links you make in the context of Preview will not be visible inside DEVONthink. It’s best to make the links in one app or the other.

When you invoke Hookmark on an item selected in DEVONthink, the Hookmark window will show you all the Hookmark links between this item, as a DEVONthink item, and anything else, wherever that anything else may reside.

By “as a DEVONthink item” we mean that Hookmark currently identifies DEVONthink items in terms of its DEVONthink URL. DEVONthink identifies its items with its x-devonthink-item URL scheme. Here is an example of a DEVONthink Markdown link generated by Hookmark for a note created in DEVONthink whose name is Note 2020-01-22: [Note 2020-01-22](x-devonthink-item://509F56A0-63E9-4F35-B243-D9C3300EAB47).

Suppose you select that item and link it to something else, such as a web page in any compliant browser, say https://hookproductivity.com`. Then when you invoke Hookmark on that note, you would see the link tohttps://hookproductivity.com`. When you access the Hookmark popup window in a web browser, you would see a link back to the DEVONthink item. Accessing that item via Hookmark would open the note in DEVONthink (because that is the scheme of the URL).

However, if you were to open that same note outside DEVONthink (in TextEdit, for instance), and then invoke Hookmark, you would not see the link back to the web page. That’s because outside of DEVONthink, Hookmark only knows the file’s path.

Please keep in mind that DEVONthink may delete files in Finder (~/Library/Application Support/DEVONthink 3/) that are still in its database (as opposed to indexed files), for instance if you offload the database and resync it. This would obviously break any links to the file that you created with Hookmark while you were using an external app (such as Apple TextEdit or Marked). Hookmark (or any other app) cannot retrieve a file that no longer exists. If that happens, you can retrieve the links using Hookmark’s search tool. To restore those links, find the file with Hookmark’s search, do Copy All Links from Hookmark’s search, and then use Hook to Copied Links on the newly found file. When you restore the links, consider restoring them to the x-devonthink-item or make a copy of the file outside of DEVONthink.

Therefore, for files that are inside DEVONthink’s database (as opposed to merely indexed by DEVONthink), we do not recommend invoking Hookmark in context of external apps. Best to simply invoke Hookmark in DEVONthink itself.

Importing linked items into DEVONthink

Also, if you import a file from the Finder to DEVONthink, its URL will change from hook://file to a x-devonthink-item, so any links to and from this file will be unavailable inside DEVONthink. (Similarly aliases that pointed to that file will not work, unless of course you keep the original).


Linking Synced DEVONthink data

DEVONthink enables you to automatically sync your data across multiple devices. Hookmark has a syncing mechanism too. This means that your links to DEVONthink items on one Mac will work on the other if the DEVONthink item is also available there.

Sync all Hookmark’s bookmarks to DEVONthink with Zsolt Benke’s script

Zsolt Benke has written a script to Archive Hookmark bookmarks with DEVONthink.

Zsolt writes:

In conjunction with DEVONthink, we can archive our bookmarks from Hookmark and save them as Pinboard does. I made a script for this a while back and it’s really helpful. It runs once a week, archives all websites from my Hookmark database into DEVONthink.

This functionality is also discussed on the Hookmark Forum.

This means that you can access Hookmark’s bookmarks on any iPhone or iPad if you also use DEVONthink and enable DEVONthink’s sync.

Previous versions of DEVONthink, and other ways of using Hookmark with DEVONthink

Hookmark has built-in integration scripts that work with DEVONthink 3, as described above. DEVONthink 3 is a major upgrade from version 2.

If you are using version 2.0 of DEVONthink, or if you would like Hookmark to integrate with DEVONthink 3 in a different way (using hook://file URLs instead of x-devonthink-item URL), please see: Customizing Hook Integration with DEVONthink.

Pro tip:

For files that are only indexed by DEVONthink but not stored in its database, a case can be made for using hook://file URLs. But for files stored in the DEVONthink database, it is normally best to rely on x-devonthink-item URLs, particularly if you are syncing them, otherwise their URLs may change in ways that are opaque to Hookmark.

Reveal File in Finder

One of Hookmark’s many handy commands is Reveal File in Finder. This provides a uniform gesture for revealing the location of files on Finder. This greatly reduces reliance on Spotlight (search is slow and effortful), and ferreting through app user interfaces (different apps put the command in different places, and many apps don’t even provide the command!)

Keep in mind however that you should not move or rename files in a DEVONthink database, unless it’s in an “indexed folder”.

Additional AppleScript for DEVONthink + Hookmark automation

You might also be interested in our Scripts to Apply & Sync a DEVONthink “Hook” tag — and More DEVONthink Goodies.

Cognitive Productivity with information managers


These books are relevant to users of DEVONthink and other great personal information managers. DEVONthink is discussed in the second book.