Is there a way to dynamically change attributes for all tags

I would like to set all tags for a device as disabled (Enabled = False) and then re-enable the all those same tags at a later time so that essentially a device can be taken offline (no new tag values being recorded because the customer has the device in a mode where they do not want the values recorded) and then put back online (tag value updates re-enabled).

There may be subfolders and more tags also, so I would want it to be recursive.

Example for one tag at a time:

system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/MyDeviceFolder/MyTag_1", attributes={"Enabled":"False"}) system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder /MyTag_2", attributes={"Enabled":"False"}) system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_1", attributes={"Enabled":"False"}) system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_2", attributes={"Enabled":"False"})

I would like to do an equivalent that would disable all the tags recursively in one statement if possible:

system.tag.editTag(tagPath="MyOPCServer/DeviceSet/ MyDeviceFolder ", attributes={"Enabled":"False"})

I guess I could do something using system.tag.browseTags like:

tags = system.tag.browseTags(parentPath=" MyOPCServer /DeviceSet/ MyDeviceFolder ") for tag in tags: # Check for tags where tag.isOPC() is true and disable # Check for tags where tag.isFolder() is true and do system.tag.browseTags on the subfolder # etc…

But is there a simpler solution?

Is there a reason you can’t use a “driven” scan class (or classes) with a slow rate of “0” ? With a boolean memory tag as the “driving” tag, your script would just set or reset it. Ignition would do the rest.

See Scan Classes in the user manual.

Thanks Phil. The “driven” scan class idea would work. But since there may be hundreds of devices and any single one of them may be taken “offline” at any point, I would potentially need hundreds of separate scan classes.

Also, our project allows for the customer to add new devices through a semi-automatic interface, which would require a new scan class to be automatically created with each new device. Doable, but more complicated than I had hoped.