Get Tag Paths triggering Client Tag Change Script

Is there a way for a script to access all the tag paths that trigger a Client Tag Change Script? The script can be triggered by any of the tags, but the operations of the script actually depend on the values of all the Tag Change triggers. Currently I’m using browseTags to dynamically get all the same tag paths within the script, but it would be amazing if the script could dynamically get all the triggering paths already entered.

You cannot, short of deciphering Ignition’s compressed binary resource format for event scripting.

The event does carry the tag information identifying which one triggered.

Consider moving your event code to a script module, and in that script module define a constant list (at the top level) of all of the tag paths you will need. Then your actual event function can just do a system.tag.readAll() from that constant.

1 Like

You cannot, short of deciphering Ignition’s compressed binary resource format for event scripting.

That's what I figured, thank you for the confirmation.

Consider moving your event code to a script module, and in that script module define a constant list (at the top level) of all of the tag paths you will need. Then your actual event function can just do a system.tag.readAll() from that constant.

That's what I'm already doing, but it requires two copies of the tag paths and thus creates risk for confusion as people copy my module to their projects and set their own triggers. There's one copy in the tag triggers for the Client Tag Change Script, and a second copy in the project.access.level() script called by the tag change script.

Consider using a set() instead of a list(), initialized to empty in the script module. Populate it with tag paths as the events come in (all will at least get an initialChange). Then use that set for the readAll.

Also consider using a dict(), with tag paths as keys and newValues as the values. After all the initialChange events are done (which will happen very quickly), you won’t have to read the tags at all, just enumerate the dictionary.

Thank you for the suggestion! I got it kind of working with the code below. All the triggers fire on initial client startup and fully populate triggerPathsAndValues as expected. However, triggerPathsAndValues is cleared when the client automatically updates from published Designer changes and the initialChange triggers don’t seem to re-fire.

Any ideas for making triggerPathsAndValues stay persistent across Designer publishing + client updates, or for making the intialChange triggers re-fire?

# stsVisiblePathsAndValues = dict()     # Not actually necessary

def refresh(event = None, initialChange = None, newValue = None): 

	global triggerPathsAndValues

	eventpath = event.getTagPath().toString()
	if eventpath.find('[') >= 0:		# Confirm path includes tag provider
		try:
			triggerPathsAndValues[eventpath] = newValue
		except NameError:
			triggerPathsAndValues = {eventpath: newValue}

In case I try working on this again in the future, try adding one of these tags to the event trigger. If the events don't work consistently, this one tag could be checked with a timer script.

  • [System]Client/System/EditCount (v7.9)
  • [System]Client/System/LastProjectUpdate (v8)

Reference these posts:

Assuming those don't work, I may be able to submit a bug report about:

After selecting "Project update available. Click here to update”, some global variables of mine of deleted. The global variables are set from a Client Tag Change script, but the script isn't triggered after a client update as it when the client is first started.