Using Hook with DEVONthink by DEVONtechnologies
Hook is a contextual information retrieval tool that links data from your favorite apps. So it’s no surprise that Hook 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 Hook with DEVONthink
You can use all your favorite Hook commands and shortcuts in the context of the selected DEVONthink item. Just select or open an item in DEVONthink, and invoke Hook (using ⌘⇧SPACE, the menu bar icon or a Dock link) as you would in any other app. (See Getting Started – Hook).
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 Hook 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 Hook window.
Linking (for example)
In particular, you can link to and from items in DEVONthink as you would in any other app:
- open or select an item in DEVONthink,
- invoke the Hook window (with ⌘⇧SPACE or other means) and use the “Copy as Link” in Hook’s title bar menu (⌃T) or use ⌘C,
- select or open a different item (in any compliant app, including DEVONthink), and
- invoke the Hook 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 Hook window on one of the items, you will see a link to the other in the Hook window. To navigate between the two, just double-click on the link in the Hook window.
Copying and pasting URLs in DEVONthink
You can also paste URLs obtained from Hook “in line”, directly into DEVONthink items. For example, in a web browser (where you are presumably currently reading this document),
- invoke Hook.
- Use the
Copy Markdown Linkfunction
Then in any DEVONthink item, you can use DEVONthink’s own paste command to paste the hyperlink.
Hook is perhaps the most rapid way to get fully formatted links. What’s more, Hook’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
Hook to New with DEVONthink
When you use Hook’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
- create a new empty plain text document in DEVONthink’s global inbox,
- name it according to Hook’s general naming rules (based on the name of the current item),
- link it to the current item. (“Current item”, as usual, means the context in which you invoke Hook, 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.) And
- 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!
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 Hook window on an item in DEVONthink shows you all and only the links you forged with Hook 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 Hook on an item selected in DEVONthink, the Hook window will show you all the Hook 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 Hook 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 Hook for a note created in DEVONthink whose name is
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 Hook on that note, you would see the link tohttps://hookproductivity.com`. When you access the Hook popup window in a web browser, you would see a link back to the DEVONthink item. Accessing that item via Hook 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 Hook, you would not see the link back to the web page. That’s because outside of DEVONthink, Hook 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 Hook while you were using an external app (such as Apple TextEdit or Marked). Hook (or any other app) cannot retrieve a file that no longer exists. If that happens, you can retrieve the links using Hook’s search tool. To restore those links, find the file with Hook’s search, do
Copy All Links from Hook’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 Hook in context of external apps. Best to simply invoke Hook 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. Hook 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 Hook’s bookmarks to DEVONthink with Zsolt Benke’s script
In conjunction with DEVONthink, we can archive our bookmarks from Hook 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 Hook database into DEVONthink.
This functionality is also discussed on the Hook Productivity Forum
This means that you can access Hook’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 Hook with DEVONthink
Hook 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 Hook 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.
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 DEVONthink database, it is normally best to rely on
x-devonthink-item URL, particularly if you are syncing them, otherwise their URLs may change in ways that are opaque to Hook.
Reveal File in Finder
One of Hook’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 apps’ 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 + Hook automation
You might also be interested in our Scripts to Apply & Sync a DEVONthink “Hook” tag — and More DEVONthink Goodies – Hook.
Cognitive Productivity with information managers
Our co-founders Cognitive Productivity the productivity that matters most to knowledge workers, students and enthusiasts: cognitive productivity.
- Cognitive Productivity: Using Knowledge to Become Profoundly Effective, and
- Cognitive Productivity with macOS: 7 Principles for Getting Smarter with Knowledge
These books are relevant to users of DEVONthink and other great personal information managers. DEVONthink is discussed in the second book.