I started out wondering if there is a DevonThink url scheme for launching a search for items with a certain tag. I know I can create a smart group that filters to a tag, and I can also get the URL for a tag, but I was hoping I could add a standard URL within a master project document that creates a query for all documents with the project tag.
I found some very advanced constructions that converted into AppleScript, but I have not found any kind of comprehensive guide to the basics of url schemes in DevonThink. Please direct me to any resources that may educate me!
Is there a way to force search URLs to open a new window? I ask because I use search URLs fairly frequently—often adding them to various Markdown notes that refer to certain subsets of my notes—and when I click on the search URLs, the search appears in the background.
The exact behaviour seems to be hard to pin down. If no other DT windows are open, clicking a hyperlink with a search URL in an open note (e.g. the only open window) causes a new window open, showing the search results. However, if multiple DT windows are already open, clicking on a search URL—while it does actually perform the search, doesn’t bring the search results window the foreground.
I’ve hunted through the DT documentation but cannot find any URL parameter / “flag” that will force search results to be shown in a new window, or activate the existing (reused) search results window.
Finally, minor but irritating is the fact that clicking on a search hyperlink causes macOS to “beep” (sort of a “thunk” system sound). The ability to turn this off would be appreciated.
As a follow up, I’ve noticed that some search queries don’t work on DTTG v3. From the bit of “digging” that I’ve done, it seems that the kind search facet isn’t supported (?) on DTTG. For example, the search query below works perfectly on macOS, but not on iOS:
tags:tech;term kind:markdown
Changing to just tags:tech;term works.
As an aside: search results display on iOS isn’t as “nice” as on macOS… on macOS the search results show the note icon, which I use extensively, but on iOS each search result just has a little circle; and on macOS there is a “score” bar graph. Wondering if some of the macOS goodness will find its way to iOS? Similar thought/question arises around Smart Groups… (?)
Another question: Is there documentation somewhere that describes how to correctly URL encode search URLs? I ask because I’ve experimented a fair bit and have sort-of gotten things working, as follows:
Given a working search query—shown in the DT search field—as follows …
tag:tech tag:term kind:markdown name!=Tech Terms
… what works is a “partially URL-encoded” encoded query of the form:
Any chance ‘kind’ could/will become a supported prefix in DTTG? Or, expressed more generally, are you able to share general thoughts re DTTG vs macOS parity? (though I know that you, rightly, don’t discuss product plans in public)
Try escaping the semicolon (%3B). That’s one of the characters that must be urlencoded. Similar to space, #, /,?,& and possibly some others. I guess Wikipedia knows all about it.
In fact, ; is an alternative to & in search strings. So in your example, you’re effectively breaking the URL.
@chrillek Thanks. I previously tried URL-encoding semicolon and the hyperlink didn’t work. Further investigation shows that I was almost there, but reveals a new question.
The following simple (tags-only) search URL works:
x-devonthink://search?query=tags:tech%3Bterm
Clicking on the above search hyperlink results in:
The same happens when I paste the URL into Firefox (though I hear a meagre beep then). So I guess(!) the URL you used is slightly diffferent from x-devonthink://search?query=tags:tech%3Bterm%20kind:markdown