Trigger script Tag value change

Hello,

I have script to generate xml file:

from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
import xml.etree.cElementTree as ET

value1 = system.tag.read(“Torque/Torque_IP033/LTR_TIMESTAMP”).value
value2 = system.tag.read(“Torque/Torque_IP033/LTR_TORQUE_STATUS”).value
value3 = system.tag.read(“Torque/Torque_IP033/LTR_TORQUE_VALUE”).value
root = ET.Element(“root”)
doc = ET.SubElement(root, “doc”)

ET.SubElement(doc, “Date”, name=“Today”).text = str(value1)
ET.SubElement(doc, “Torque”, name=“Status”).text = str(value2)
ET.SubElement(doc, “Torque”, name=“Status”).text = str(value3)

tree = ET.ElementTree(root)
tree.write(“C:\CSV\person4.xml”)

I would like to run this script every time the time stamp value change. I can run it on the button trigger but I would like this to be triggered always when tag value change regardless if client is opened or not.

Regads
Pawel

You can use Tag Event scripts for this. These run on the gateway, so will run whether the client is opened or not, but they can only write to a gateway accessible path.
https://www.inductiveuniversity.com/videos/tag-scripts/7.9

Thanks accyroy.

Totally forgot Ignition Gateway is in different server, so my script did not work because Gateway has no access in to location I did pointed.

Thanks a lot again.
Regards
Pawel