So, a while back, I needed to create an alarming module for Ignition, to replace an older software package. The older version read off a very roughly formatted HTML file. So, since I needed to write a script to parse and separate the valuable information from the huge amount of HTML cruft anyway, I extended the script to create Ignition alarms and write all the parsed information to their relevant properties, Name, Notes, Priority, setpoints, etc. Ran it as a gateway event script off a timer, worked like a charm.
Iām currently copying out a page from another piece of software we present as a large table. We have many different thermocouples, and weād like to keep the functionality whereby when a particular temperature gets out of range, the background for that TCās cell goes red. At the moment, this requires me to create each text field:
- Write a simple script in its Text property to read and then format the relevant tag value.
- Write a script for the background color, setting its value to red if certain conditions are met, or transparent if not.
Even with copy/pasting, this is hours of brainless work, and Iām setting myself up to have to go bug hunting for typos in the bindings when itās done.
Iām wondering if itās possible write a python script to access individual components and their properties, which Iāve only so far managed with expressions and event scripting. Then, could I have my code access the binding associated with a components property and write the expression script automatically? The script itself is very simple, one line in each case, with the only change being the name of the tags, which could be provided via a .csv list or some such.
Essentially, I can see a way to do all this (looks like 1 day of work based on how its going) with about 10 lines of pseudocode, that would probably execute in a second or two, given how quickly the alarms updated. The secret sauce is being able to access and modify components properties, and scripts, outside of the usual GUI. Is that possible?
Iām thinking something like how system.tag.editTag has the AlarmConfig keyword argument that allowed me to write alarms to tags from a script.
And though Iāll probably be done brute forcing this by the time I get an answer, I see this coming up again, so itās of general interest to me