Hello. I am working with labview scripting in order to create a script that will replace all selected indicators with an indicator from a ctl file. However, I can't seem to figure out the GObject method "Replace". Attached is my current script. I was wondering if anyone could let me know what I am doing wrong or if what I am trying to do is even possible. Thanks.
Solved! Go to Solution.
A few tips.
It looks like you are using the selection on the BD, therefore the objects you find will be ControlTerminals. You need to get the corresponding Control property and call its replace method.
To handle this, and allow for other random objects in your selection I would use To More Specific Class to cast each object to a ControlTerminal. If there is no error, then get the Control Property and call the replace method. If there is an error, simply do nothing. This way if there is a wire or two in the selection you are ok.
It also appears that you are using this from the Tools Menu, which is cool. You can add a check of the VI.FPIsFrontmost property to detect if you are calling from the FP or BD. If it is the FP, you can simply cast everything in the SelList to a Control and for the successful ones call the Replace method.