Can a script in a Smart Rule find out the name of the Smart Rule invoking it?

If a DEVONthink smart rule invokes an applescript script, can the script somehow find out the name of the rule that invoked it? If not directly, then is there some clever way to pass an argument to the script so that it could get a name that way?

What are you trying to accomplish?

I want to get the name (as a text string) of the smart rule that invoked the script, in the script itself.

But for what reason? Curiosity?

I could imagine that would make it possible to use one external script for several smart rules with the script behaving slightly differently in each rule.

I doubt that that’s possible in AppleScript. The language is even missing basic introspection like “get the name of the current function”. And though JavaScript is better in that, it doesn’t provide for a .caller property anymore. Meaning: it’s still there, but deprecated.

And even with that (i.e. figuring out from where a function was called), you won’t get at the smart rule’s name. But since the smart rules (might? should?) work on different selections of files, you could perhaps use the properties of (e.g.) the first record passed to the script to identify the smart rule that triggered the script.