Showing results for 
Search instead for 
Did you mean: 

GObject : Replace Method

Go to solution

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.

0 Kudos
Message 1 of 4
Accepted by topic author KeenanJohnson

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.

Message 2 of 4

Thanks very much! I got it working exactly how I wanted to.

0 Kudos
Message 3 of 4


could up attach code? Because I have the same problem and i still don't get it.

Thank you in advance,


0 Kudos
Message 4 of 4