LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New VI Object - Variant Constant [VI Scripting]

Solved!
Go to solution

Hi Everybody,

I write very important program for me and i have one problem.

I use VI Scripting component and i try generate variant constant. I use special function like New VI Object to this task. This look very simple, but....

 

var.jpg 

This implementation returns "error 1054 occured at New VI Object in Main.vi. Possible reason: The specified object was not found".

I think that class "constant" for variant is good. The owner of variant must be cluster. I tried to change owner for example block diagram, but this is not work too.

Maybe someone can help me to solve this problem?

I will be very gratefull.

 

Message 1 of 3
(2,741 Views)
Solution
Accepted by topic author Jimmy_Page

If you run the code with the class as Generic, you'll see that the variant is actually a control. I don't know if there's a way to create a constant directly, but in scripting, there are often two useful ways to do what you want:

 

  1. Do what you what you would do manually. In this case, you can create the variant as a control, get its Terminal reference and call the Change to Constant method on that.
  2. Create a VI which already has the code you want (in this case a variant constant), then open that VI and copy-paste its code into the place you want it to be. This is particuarly useful if you want to skip doing a long series of scripting moves.

___________________
Try to take over the world!
Message 2 of 3
(2,697 Views)

Most likely you try to place a constant on a frontpanel refnum. That can't work. You need a diagram (or subdiaggrram) refnum as owner refnum in order to place a constant on it.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,665 Views)