LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Scripting Main Board

Darin K provided a workaround that gets me what I need: http://forums.ni.com/t5/LabVIEW/Select-Control-Label-with-VI-Server-Scripting/m-p/2176698#M699729

I was really hoping the Label.Select would have worked.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 131 of 171
(1,164 Views)

Thanks to the examples i can create an Enum using scripting.  Is there any way to save it programmatically?

0 Kudos
Message 132 of 171
(1,164 Views)

Use the Save Instrument method.

0 Kudos
Message 133 of 171
(1,164 Views)

When i attempt to wire in the Save Instrument method, LabVIEW reports it as an invalid method.

Scripting.png

0 Kudos
Message 134 of 171
(1,164 Views)

I'd do it like this:

CreateEnum.png

Message 135 of 171
(1,164 Views)

Darik.K gave you the full correct solution, but I would like to clarify things a bit.  If you want to save any custom control (such as an enum), you need to actually create a custom control (which is a variant of a VI, see Darin.K's example).  The easiest way to do this is to create the custom control first, then drop it on your front panel using the New VI Object primitive and specifying the path to the custom control as the input.  The key point is that the custom control is a separate item from the VI you are using it in.

0 Kudos
Message 136 of 171
(1,164 Views)

Thanks for the reply.  I got it to work using scripting, then realized that i didn't need scripting to do what i wanted to do.  I was suprised to find out that i can modify an enum using VI server and then save it programmatically.  Seems unusual that NI would allow that, but if it is a bug, i don't want it fixed.  It saves me a lot of headaches!

0 Kudos
Message 137 of 171
(1,164 Views)

Ok, so I created a strict typedef of an array of clusters using scripting, set the default value, and saved it to a file.  When I open the file, the typedef looks right and contains the default value that I set in the creation script.  In the same code, I create a new VI from a template, and create a constant on the block diagram using the new VI scripting function, and passing it a path to the newly created strict typedef.  The constant has the right structure, but is an empty array.  If I run the part that creates the VI a second time (After the code stopped, I assume that clears stuff from memory) the new VI now has a constant WITH data.

Can anyone tell me how to get this to work the first time?  Is there a way to flush the typedef from memory before I create the sub-vi that I want to place it in as a constant?

Thanks in advance,

David Dupont

0 Kudos
Message 138 of 171
(1,164 Views)

Figured it out.  If you are diligent about closing your references when you're done with them then things work more like you want them to.

Thanks anyhow.

David

0 Kudos
Message 139 of 171
(1,164 Views)

Can I access the Tools Palette through scripting?  I have two monitors at work, but ocassionally bring my laptop home where I dont have a second monitor.  If I had my tools palette open on my second monitor at work, and then try to do some work at home, no more tools palette without a LabVIEW restart.  If I can access it, I would like to programattically change its position, perhaps via a quickdrop plugin...

0 Kudos
Message 140 of 171
(1,164 Views)