Search method in scripts: get exact location of match?

Two questions re search in scripts.

  • Is it possible to get an item link to the matches in a document? E.g., I search for a string in a list of PDFs and get a single result (one file, one occurrence of the search term). The string is highlighted in the PDF when I select the document in the list view – is it possible to convert this highlighted text to an annotation automagically, i.e. with a script?
  • Am I right to assume that the scope prefix in a programmatic search does not only accept databases (as the documentation says) but in fact group names and even a path to a group like “statement/bank A” or “documents/receipts/dinner”? In that case, I’d appreciate a small update to the documentation.

Only by creating the links and adding the annotations to the PDF on your own (via the PDFkit), the search just returns the found records/items.

The scope syntax doesn’t support groups or paths, actually the search AppleScript command doesn’t support the scope at all. See in parameter.

Sorry, I was mixing two things here. The scope question was actually referring to setting the viewerWindow’s ‘searchQuery’ parameter. There it seems that the ‘scope:’ prefix allows group (hierarchies).

No, definitely not.