windingwind / zotero-actions-tags

Customize your Zotero workflow.
GNU Affero General Public License v3.0
1.83k stars 48 forks source link

[Feature] Add a TRIGGER_EVENT variable #253

Closed garth74 closed 8 months ago

garth74 commented 8 months ago

Is there an existing issue for this?

Environment

Describe the feature request

Is your feature request related to a problem? Please describe.

Is it possible to include a variable like trigger or event that indicates what shortcut triggered the script to run? For example, in #245, I separate the collection trigger from the item triggers based on the truthy-ness of collection. Although this works, a more straightforward solution would be to have a variable that could more directly be used to filter the script functionality. Admittedly, this would overlap to have scripts for separate triggers.

Why do you need this feature?

In several of the community scripts (e.g., #115, #245, #198, etc.), there are situations where some functionality is exposed for certain trigger events. As a result, the trigger event is typically inferred based on variable values such as items being null or item not being null. Although these methods work in some cases, inferring the trigger event for other contexts is impossible. It also makes extending existing scripts a challenge.

Describe the solution you'd like

No solution is necessary; this idea would make some things easier, but I can also see it creating performance issues down the road.

Anything else?

No response

windingwind commented 8 months ago

Exposing them to the script makes sense to me!

windingwind commented 8 months ago

It‘s available in the latest beta (v1.0.0-beta.34)