LabVIEW APIs Discussions

Showing results for 
Search instead for 
Did you mean: 

[Scripting] Copy control from running VI


Hey all,

I have an interesting situation that I can't figure out how to do.  I want to take a control from a running VI and replicate it on a new VI (with the same colors, properties, etc).  However using the TopLevelDiagram:Make Selection and Copy selection methods, you can only copy from a VI in edit mode.  Does anyone have other ideas on how to accomplish replicating a control using VI Scripting?

Thanks for the help,


0 Kudos
Message 1 of 6

Why can't you get a refnum to the control you want to copy, read it's properties, create a new control, and set the properties?

Message 2 of 6

I can get you close, but not the exact control...

The forum won't let me post images at the moment... I'm not sure why... so I posted the image of the diagram here:

Message 3 of 6

Just use the VI's Create by Reference method. I added a snippet in AQ's thread.

Try to take over the world!
Message 4 of 6

Hey thanks everyone for the advice.

Steve:  This would definitely work, just requires more work when I was pretty certain there was a much simpler method.

AQ:  This copies the data type of the control only, I was looking to copy all of the properties, class type, colors etc. 

tst:  This seems to do exactly what I was looking for!

Attached is the VI example in case anyone stumbles across this later on...

0 Kudos
Message 5 of 6

*head smack* I forgot about that method. Good catch, tst.

Message 6 of 6