Out of band linking, for want of a better term

Here’s a future challenge. I have about 4800 documents in a Devonthink database. This is a dump of State statutes.

I need to log unfolding events and reference them to the laws involved.

Every two years, all those laws are updated. The next update will be in a few months.

Is there an easy way to create semantic links?

Here’s one scenario. Let’s say I write notes that reference the Texas Unemployment Compensation Act section 201.011.

That’s currently in a file called la.201.htm. The next release of the law might use a different file name.

I need to get the next version of the law and maintain the linkage between my notes.

In other words, I need to link to the content, not a Wiki or an item link.

One cumbersome idea is to link my notes to a smart group that searches for content matching both “Texas Unemployment Compensation Act” and “201.011”.

That takes time to create, though. When I want to create a semantic link I have to save a search as a smart group, move the smart group into the database where it won’t be in the way, and copy its item link as a target for a link in my notes.

The trick is to create a link that will survive replacing the target file with a new version.

Any thoughts appreciated.

If not, I’ll make Wiki links which will survive the target file getting replaced, as long as it is replaced with the same file name, and hope for the best.

Actually automatic Wiki links based on names & aliases might be an option by adding the necessary aliases to the files.

In another thread, the solution emerged - a URL command can be a search query.

I’ve discovered searches with command URLs will even work from external apps, but only if the database is already open in DT.

It’s perfect. URL encoding for the command is a trifling inconvenience. I think I’ll write a one or two line Python script to do that for me. My plan is to use DT’ search function to get the search parameters correct with the point and click menus, copy the search string and paste it into a URL encoder. Or maybe (likely) something already exists.

Keyboard Maestro has a filter function which can be used to do things like URL encode the clipboard. I’m lazy, that’s easy integration.

As soon as I’m back at my desk I’ll try it.

I’ve been using this for years…


And if you’re not already using PopClip, I highly recommend it. An affordable and amazing little utility. And the developer is very responsive and a nice guy too! :slight_smile:


Nice! I think I need that.

For the moment, this is working.

First, prototype the search with the search field in Devonthink. When the results appear as expected with current data, command-A/command-C copy the query string from the search entry field.

Open a markdown document and hit option-command-S, the hot key I chose for a Keyboard Maestro macro using “filter” and URL encoding. A fully formed markdown link appears.

The search command URL appears to work from external apps, too, as long as the database you specify in the scope parameter is already open in DT.

Another caveat has to do with treatment of some characters. For instance, if you search for something with a dot or other encodable character, bracket the search term with double quotes.

Command URLs are a very cool feature.

1 Like