Run Script from Context Menu?

I found this script to index bookmarks Capture in Smart Rule by @cgrunenberg to be particularly helpful and is something I am likely to use routinely - likely with a slight modification to apply to other file types such as RSS feed entries.

Activating it from a Smart Rule is certainly a helpful way to use it. But at times I would like to use it on a specific item or a specific set of items. I could of course place the script in the user script directory, but for something used regularly it would be nice to right-click and have immediate access to it.

I can sort of do this now by activating the Smart Rule only “On Demand” and then choosing the script under “Apply Rules.” But to be able to apply it that way on any item I would need to have the selection criteria for the rule wide enough to include every item in my database.

So questions are:

(1) If I do as above and create an “On Demand” smart rule which includes every item in my database - and then I activate the rule on specific items through the context menu -is that inefficient by having so many items listed by the Smart Rule?

(2) Is there some other way to add a script as a context menu item other than as “Apply Rules”?

  1. Why would you need it to include every item in the database?
  2. No there is no way to modify the contextual menus.

What I would like to be abe to do is to select any arbitrary item in my database and index that through “Apply Rules.”

But if I do not set the Smart Rule to include every item in the database, then the rule fails if I try to apply it to an item not within the scope of the rule.

Or am I missing something in how the Smart Rule works?

That said, does it “hurt” things to have an “On Demand” Smart Rule that includes my entire database? Does this consume processing power other than on initial startup?

Criss’ script wasn’t indexing any arbitrary item in a database. It was for getting the content of a bookmark by temporarily downloading it and putting it in the comment of the file. That would not apply to all file types.

That said, does it “hurt” things to have an “On Demand” Smart Rule that includes my entire database? Does this consume processing power other than on initial startup?

No it doesn’t hurt anything, but it can also be a very unwise thing to do, depending on the actions in the smart rule.

You could also add the script to the toolbar. Or just drag the items onto the smart rule, in this case the conditions do not even matter.

Yes I understand that. His script was great for inspiration and I already modified it to work on other filetypes.

My question now may apply to other scripts in general, not just to this one. Suppose that I write whatever script and I want to be able to apply it to any arbitrary item through the context menu. Am I correct that the only way to do that is to create a Smart Rule which includes all items and is “On Demand.” Yes I know there are risks that I could accidentally execute it on the whole database if I edit the Smart rule - is there some other way I could achieve Context-Menu activation without creating such a “global” smart rule?

Is there some other way I could achieve Context-Menu activation without creating such a “global” smart rule

Context menu activation? No.

As noted in Help > Documentation > Windows > Sidebar: Navigate > Smart Rules, you can drag and drop files onto a smart rule to have the actions apply to it, even if the item doesn’t match the criteria or targeted group.

1 Like

Excellent idea - that will work - thank you

You’re welcome

One other thought -this solution works great to me, though honestly it was not at all obvious to me until now that this concept of indexing of a bookmark or RSS entry is possible without pulling in the entire formatted document. Perhaps of interest on your (very long) list of “Nice to have” features would be a command in the Data menu to “Index Item(s).”

The script does the same thing and is terrific for now - though intrinsic support for this as a feature would be another step which likely would make many more people aware of this capability.

It’s the only request I can recall, so I guess it would depend on the broader interest and Development’s priorities.

One other very interesting side benefit I noticed of this script - the process used to import the text for indexing purposes appears to work even on articles behind a paywall - at least on a couple sites I just tried. I do respect intellectual property rights, but as several participants on the Forum have noted, some paywalls make it hard for DT3 to display or convert data even for those who have a paid account. Indexing the information makes it possible to search the complete content (or even to read it, albeit without any formatting).

Perhaps it will prove itself more useful then.