Here’s another one that may be of interest or frustration:
In the Search Window there’s a “score” column on the left of the results pane that ranks the relevance of the hits returned, but I’ve always wondered how my query played out quantitatively. Do all the results have just one or two hits? Do the quantity of hits taper off rapidly after the first few results? In a compound search, does one term return dramatically more hits than the other(s)?
The attached py-appscript takes your query, and a selection of one or more returned results, then lists the hits for each term for each item in the selection. I’ve got it setup to work with Keyboard Maestro, but you can run it from a terminal command line, or alter the output to suit your taste.
The script parses DT ‘?’ and ‘*’ wildcards into their equivalent Python regex; you’ll see this format in the returned results. I haven’t translated the DT character ranges (eg [abc]) as yet.
I’ve included an earlier version, “ui_get_hits.py” that extracted data from the “Words” drawer, but it was incredibly slow. I wouldn’t suggest anyone use this, but there may be some UI access code of interest to someone.
The useful file, “get_hits.py” needs UI access turned on, and py-appscript working with OSX system Python.
Not sure how much I will or won’t support this script, but I’d be interested in your success or failure beyond getting it to run. Hopefully you can’t destroy your data with this one, but if you manage it, please keep in mind it wasn’t my fault.
hits_from_selected_results.zip (2.75 KB)