Is there an efficient way to locate and consolidate all remanent (retained) variables in a large project, aside from globally searching for VAR RETAIN
or manually checking each .var
file?
Our projects contain numerous retained variables, which become quite time consuming to restore after a cold start. My goal is to systematically identify all retained variables outside of Automation Studio, possibly using a script to scan .var
files at startup. I am very open to other suggestions if there is a better way.
One approach I’m considering is deploying a Bash script in each directory to detect retained variables and periodically compare their values against the startup state, updating them as needed. This would help ensure that most retained values remain accurate after a restart.
Has anyone implemented a similar solution, or is there a more efficient way to handle this? Given some project path as an argument, here is the example code and output:
/mnt/c/.../Logical/...RunAxes/FeedHopper.var:17:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/Variables.var:14:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_P76TransferVacuum/Variables.var:9:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_TransferVacuum/Variables.var:9:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_TransferVacuum/Variables.var:23:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_UpperRoll/Variables.var:14:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_Vacuum/Variables.var:8:VAR RETAIN
/mnt/c/.../Logical/...RunAxes/FE_Vacuum/Variables.var:18:VAR RETAIN
I figure with this output, it is now just a matter of searching from the line number, then removing duplicates? Please let me know your thoughts!