Add Tag change scripts

I want to monitor some tags change, then do some scripts.
if i have many tags want to monitor, I have to add many tag change scripts.

Is there another idea?

Today i find we can write scripts in tag or UDT tag.
When its value changed ,we can write scripts.




But has twoproblems:
one : when PLC restart, it will write first? How I avoid it?
Two: scripts can’t invoke gateway scripts ?How I invoke it?

You can monitor a lot of tags in one tag change script. This makes the most sense when they share similar functionality. Within the script you can check which tag triggered the execution and choose the appropriate logic–something like

if "confirm_enable" in tagPath:
	# Do stuff
if "low" in tagPath:
	# Do other stuff

Problem One : solved by add script

if not initialChange:
    # Do something useful here

Problem Two: tag change Scripts can't invoke ProjectLibrary also not solved?

Use this: Ignition Docs | Gateway Scripting Project

1 Like

Yeah! one Project is OK.

But if I have two projects , they will use their each Project Library.

This is worng.How to set?
image

Create a single project that the other two inherit, and put your scripting library there:
Ignition Docs | Project Inheritance

Templates and other universal resources should be put there as well, so they don't have to be maintained in multiple places.

Even thought in Project one , I set Script scope to All.

But in Project two: I can't see or invoke the Script ?

I must to add a new Project add many public project Script .
Then when I add new project , everyone set Inheritance?

Tags are gateway global resources. They do not belong to projects. There can be only one gateway scripting project. Your individual projects will have to share script resources in the one gateway scripting project.

Consider using gateway tag change events (defined in your projects) instead of tag valueChange events (defined on the tag). The former are part of a project, and therefore use that project's script library.

1 Like