The search performs on my active database. I get results. But it’s not limiting the search in any way.
I’ve read through countless threads about this seemingly simple construct and yet I can’t get this working completely. In one thread there was mention of the scope not working when clicked outside of DT. So I used it inside DT. No luck.
I need the scope to work. Any thoughts? Am I missing something glaring?
@BLUEFROG I have a DT directory (group) containing hundreds of image assets that are specific to use on a given week of the year. The image assets are all named (prefixed) with a date that identifies the given week’s usage (in the above example it’s “11-28”, hence the 11-28 search).
These image assets run on a three year cycle, making the complete circuit 52 searches x 3. So in addition to each asset’s name, each year’s assets reside in a separate folder. Thus, each week would require my looking up this week’s prefix/search (it’s not intuitive; it has to be looked up), entering it in search manually, and then limiting the scope.
With an Excel spreadsheet (later imported into DT as a sheet) I can quickly assemble the relation between the given year’s date (aka the search term) and the given year’s folder item link, and then construct the search URLs once. Then it’s easy street: just look for this week’s entry (constructed neatly in and Excel column as “a-week-01,” “a-week-02,” “b-week-01,” and so on) and click the search to find this week’s assets.
@unlocked2412 Are we saying this can’t be done? Seems like a glaring omission. Searching my entire database is probably my least frequent scenario. But even for those who do it frequently, it’s the broadest, least-granular option. Not a great feature for URL parameters to exist but be so fundamentally limited. ??
I believe the hurdle for me would be specifying the path in the query. Each year’s files reside in a subdirectory that is named the same as the others, but one is not at the same depth.
Here’s what I managed:
Using Excel functions I constructed a Keyboard Maestro URL that tacks on as its “value” the UUID of the folder and the search term.
A sample trigger url looks like this: kmtrigger://macro=03D29691-35CD-4383-8944-56E0E507253A&value=*02-13*,AC8EAD15-712B-4BC8-9E0C-DC6FFC379547
If you notice, the “value” contains the search term and the UUID —comma separated. This leverages Keyboard Maestro’s functionality which will read a comma-separated value as an array, thus allowing “TriggerValue”, “TriggerValue”, etc. Then I can pass those off to the macro which…
Sets the search term var to x-devonthink://search?query=name:%TriggerValue%%20kind:image%20scope:selection
Sets the search scope var to x-devonthink-item://%TriggerValue%
Opens the database I need it to (just in case)
Pauses until DevonThink is open and frontmost
Opens a new window
Opens the scope URL which targets and selects the folder in question
Pauses for a few seconds and…
Opens the search URL which performs the scoped search.
Keyboard Maestro is quite finicky about URL structure. The only way I could get it all to work was to chop the URL up in sections, run an URL encode filter on some of them, and then assemble them into another, final variable which I then fed to KM to open. It did so happily.
I would have saved myself quite a bit of aggravation had I thought of that first rather than last.