Hi,
How can you read and write in the enabled property of a tag in a value changed script?
Thank you in advance.
Hi,
How can you read and write in the enabled property of a tag in a value changed script?
Thank you in advance.
Your request is rather unusual. Once you disable the tag it will stop monitoring changes.
What's the real problem you are trying to solve?
Hi, I need a counter that stays at 00:00:00 (string) when my JHook tag is equal to 0 and Arret_Automatique_Jour is equal to True.
Are you trying to make a run hour-meter? (For how long the machine has been running since midnight?)
What version of Ignition?
Do you have a database configured (which will make this much more reliable and useful)?
Tips:
@Transistor has valid comments & suggestions. There is likely a more elegant & reliable way to implement your end-goal. However:
You can write to the .Enabled property of any tag, provided the tag has appropriate R/W permissions set. To test your script in the Designer's script console: from tag browser, expand the tag in-question, right click on the "Enabled" property, then "Copy Path". Then update & execute the following script:
tagPaths = ["<paste your path here>"] # e.g. ["[default]Path/To/Tag.Enabled"]
values = [True]
print(system.tag.writeBlocking(tagPaths, values))
Note that the permissions to write to the tag from your client session may differ from the gateway's permissions of a tag event script. Also, if the tag is set to Read-Only, the writeBlocking() method above will not work, you may have to reconfigure that tag with an updated property value, which also may be done with scripting. You may use tag diagnostics to view errors generated by the tag event script after migration.
What is your end-goal?