I have cause thru scripting to disable then re-enable later the ReadOnly properties of tags. I try with scripting and get this error that makes sense lol. Is there a way or you have to do thru tag browser?

writeblocking can be used to change this value
system.tag.writeBlocking(['[Sample_Tags]TagPath/YourTag.ReadOnly'], ['true'])
or
system.tag.writeBlocking(['[Sample_Tags]TagPath/YourTag.ReadOnly'], ['false'])
It can be set to true, but once it's read only, it's read only
That is a pita for me lol.
I need to write to the AlarmEvalEnabled property of a read only tag.... I can understand not being able to write to the .value prop
Have you tried using system.tag.configure()?
I considered this as well, but based on the behavior of system.tag.getConfiguration(), it doesn't seem like it is possible to manipulate the read only property in this way. Am I mistaken about this?
Since tags are not read only by default, once the property is set to True I would expect it to show up in the configuration pulled with system.tag.getConfiguration().
You are correct. I just set up a test, and the script pulled in the read only value:
Code:
tagConfig = system.tag.getConfiguration('[Sample_Tags]Realistic/Realistic0')
for tagDict in tagConfig:
for key, value in tagDict.iteritems():
if key == 'readOnly':
print key, ' : ', value
Output:
readOnly : True
I haven't been able to get system.tag.configure to work for changing read only.
Here is my code:
tagConfig = system.tag.getConfiguration('[Sample_Tags]Realistic/Realistic0', False)
print tagConfig
print
for index, tagDict in enumerate(tagConfig):
for key, value in tagDict.iteritems():
if key == 'readOnly':
tagConfig[index]['readOnly'] = False
print tagConfig
print
print system.tag.configure('[Sample_Tags]Realistic/Realistic0', tagConfig, "o")
Here is my output:
[{u'historyEnabled': True, u'historicalDeadband': 0.1, u'dataType': Float8, u'readOnly': True, u'enabled': True, u'historyProvider': u'Sample_SQLite_Database', u'path': [Sample_Tags]Realistic/Realistic0, u'opcItemPath': u'ns=1;s=[Sample_Device]_Meta:Realistic/Realistic0', u'tagType': AtomicTag, u'name': u'Realistic0', u'opcServer': u'Ignition OPC UA Server', u'valueSource': u'opc'}]
[{u'historyEnabled': True, u'historicalDeadband': 0.1, u'dataType': Float8, u'readOnly': False, u'enabled': True, u'historyProvider': u'Sample_SQLite_Database', u'path': [Sample_Tags]Realistic/Realistic0, u'opcItemPath': u'ns=1;s=[Sample_Device]_Meta:Realistic/Realistic0', u'tagType': AtomicTag, u'name': u'Realistic0', u'opcServer': u'Ignition OPC UA Server', u'valueSource': u'opc'}]
[Bad_Unsupported("The target path '[Sample_Tags]Realistic/Realistic0' cannot accept children tags.")]
when you write the config back you need to go up one layer
print system.tag.configure('[Sample_Tags]Realistic/', tagConfig, "o")
Yes. That is the key -- Read only is turned off on my test tag after making this change
Edit: putting all together:
tagPath = '[Default]YourTagPath'
tag = 'YourTagName'
tagConfig = system.tag.getConfiguration(tagPath + '/'+ tag, False)
for index, tagDict in enumerate(tagConfig):
for key, value in tagDict.iteritems():
if key == 'readOnly':
tagConfig[index]['readOnly'] = False
system.tag.configure(tagPath, tagConfig, "o")
#======================
#Do tag writing here
#======================
system.tag.writeBlocking([tagPath + '/'+ tag + '.ReadOnly'], ['true'])
Just a note to say that unless you need to ensure the write is successful, you can use system.tag.writeAsync() here in place of system.tag.writeBlocking(). And also that you should be able to include all of the writes in one call.