Script: Add reference URL to aliases and create Smart Group

@rufus123 asked whether it’s possible to find a record via its reference URL , see Crazy suggestion: accept links in search boxes. To do this I wrote this script.

And @AW2307 asked for a way to include the records’ name in a markdown group’s transclusion record, see this post. Instead of setting up the Smart Rules manually we came up with the solution to set the Smart Groups search results by using the “reference URL in aliases” approach. This way there’s only one Smart Group needed.

I think the script will be useful in a Smart Rule scenario where we don’t want a dynamic search but know beforehand that we want to match a static set of groups (and don’t want to use Custom Meta Data). Instead of creating several Smart Rules with different scopes we can use a single Smart Rule and let its script act on this static set of groups (or records).

Nope, the script uses any:

(I’ve moved the resulting Smart Group from the global inbox to the selected records’ database)

If I would drag this Smart Group onto the sidebar’s Smart Rules section I then could set up a script that acts on the previously selected records. So it’s a way to set a Smart Group/Rule’s search results without the need to use extra Custom Meta Data.