Run Tag Event Script from Button Press (Gateway and Project Scope)

I would like to put a button on the screen to manually fire the script that typically runs automatically based on a tag event.

Is there a way to manually call the tag event script directly from the tag?

Or, will I have to more-or-less copy paste and make adjustments for calling from the button script instead of the tag change script?

Place the script in a Script Library, then you can call it from both the Tag Event and a Button press.


I have the script in the library, but there are properties of the tag that I need to pass to the script.

You can read tag properties from a tag using

1 Like

This project script calls a named query. Typically, it's from the gateway scope, so my named query call has extra parameters when calling from the button press (project/client) scope that is causing errors.

Any way to avoid this without adding an extra parameter to my project script?

I decided to just add an optional parameter to my project script, since that's the easiest solution. Default "clientScope" variable to 0 (false), and it can be provided as true when needed to call from the project scope.

This is the only way that I know of.

1 Like

You can also use system.util.sendMessage to the gateway and let the gateway message handler call the library script. It will then be in gateway scope all of the time.

1 Like