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!
As with many things DEVONthink, check the Help.
Help > Documentation > Automation > URL Commands.
And an example…
Thanks! Of course there’s a help section. I had searched for “url scheme”. This is exactly what I was looking for!
Is there item link command that I can open the file with default app rather than open in DTP when I click link? I didn’t find it…
As far as I know that’s not possible.
In case you use RTF you could try Script: Open RTF links in default app. Select the link(s), run the script and it opens each link in the default app.
No that’s not possible. That’s not how URL schemes work.
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.
The next release will add an optional
open parameter and fix the beep issue.
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:
Changing to just
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:
… where, interestingly enough, only spaces need to be URL-encoded (i.e.
%20) but colons (
:) do not.
If, however, I use
tags: instead of two
tag: items, as follows …
tags:tech;term kind:markdown name!=Tech Terms
… then the URL-encoded form …
%3B to represent
;) doesn’t work.
Neither does …
x-devonthink://search?query=tags:tech;term%20kind:markdown%20name!=Tech%20Terms (i.e. using a literal
; in the search URL).
kind is not a search prefix in DEVONthink To Go.
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)
Thoughts on the URL encoding question? That is, how to correctly encode semicolon so that search URLs work correctly?
Full parity wouldn’t happen for awhile and would require some under-the-hood and UI changes in DEVONthink To Go.
kind may happen sooner but development would have to weigh in on it.
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:
Clicking on the above search hyperlink results in:
However, adding subsequent “parts”—like
kind:markdown—to the query hyperlink doesn’t work. For example …
… doesn’t work, causing DT to show the following after clicking on the hyperlink:
That actually works here when I click on it in the mail I received from the forum software.
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