I want to be able to search within a document window, setting the search string programmatically (rather than typing or pasting into the Find field in the Inspector). It seems that this isn’t currently possible.
The use case is this: I save extracts from a pdf as separate plain text files. I include with each extract an x-devonthink-item link to the document/page so that I can easily jump back to view the extract in context. However, this works only at the page level. Further to this, I want to be able to write a script that will not only show the page but also immediately highlight the specific text that has been extracted—i.e. by searching the document for that string and moving the page to that position.
Viewer windows have the
search query property that allows for the search string to be set. This also sets the search string for document windows. However, this involves a database-wide search, and it doesn’t allow for the search string to be actually triggered in the document window (it seems) unless the Inspector pane is open and the Find field is interacted with (in which case one might as well just paste into the field). I’ve got a Keyboard Maestro macro that will do this but it isn’t very elegant and causes some other problems.
Ideally, what would solve my problem would be this: for
search query to be an editable property of document windows (independently from other DEVONthink windows), and for setting this property to highlight the first match in the document (like pressing ⌘G).
In Script Debugger, just to give an example, this can be done by setting the
search string property and then using the command
search with action find next.