Has anyone had any success reading tag change event scripts?
I can read the EventScripts property for a given tag and get the event name for each script by iterating through the results of calling getDefinedEvents on the read value of the EventScripts property but I don’t know how to get the actual text of the event script.
This code prints out “valueChanged” but I also need the text of the script. Any ideas?
path = "Devices/SOME_DEVICE/lastupdate.EventScripts"
res = system.tag.read(path)
for e in res.value.getDefinedEvents():
print e
Output of:
print dir(e)
is
['__add__', '__class__', '__cmp__', '__contains__', '__delattr__', '__doc__', '__eq__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__hash__', '__init__', '__len__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'islower', 'isnumeric', 'isspace', 'istitle', 'isunicode', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']