LabVIEW APIs Discussions

Showing results for 
Search instead for 
Did you mean: 
Reply

LabVIEW Scripting Main Board

LabVIEW Scripting Main Board

This thread is intended to foster discussion regarding LabVIEW Scripting. Please post any general comments or questions here, so they can be answered by experts in the community or from NI.  Or, if you have specific questions feel free to start a new discussion thread.

0 Kudos
Message 1 of 170 (45,271 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

Hi

My implementation with VI Scripting Tool.

http://www.youtube.com/watch?v=4IUGQ0GH1QE

0 Kudos
Message 2 of 170 (36 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

Wow this is awesome!  Very cool Antonio.

0 Kudos
Message 3 of 170 (36 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

Here's the first post on my LabVIEW blog about scripting.

LabVIEW Scripting Tip #1:  The Power of Traverse

-D

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Message 4 of 170 (36 Views)

Definable Constants using LabVIEW Scripting

Many programming languages have a means to define a constant, use a label to refer to that constant, and then at compile time replace that label with the constant.  This allows the programmer to set a value one place in code and then use it in many places without additional overhead.  This is often utilized for array indices, seldom changed parameters, conversion factors, etc.  For example, in C this takes the form #define label value.  LabVIEW, as of version 8.6, does not directly support this functionality.  Sure, there are several workarounds including the use of global variables (which adds overhead), subVIs (which may add overhead and at a minimum get cumbersome), and conditional disable structures (which aren't practical for constants that may contain a large range of values).  This overhead is especially significant when programming in the Real-Time and FPGA modules.

Using the newly released VI Scripting I have created a VI that replaces the values of specifically labeled numeric constants with the values contained in one or more configuration files.  The program operates recursively within a directory structure such that a particular configuration file can be applied to a single directory or an entire project.  This is far from an ideal solution since a manual step is required whenever defined value is changed; however, it allows the programmer to use constants without the trouble of manually updating each copy whenever the value changes.  Note, that this is not meant to be a substitute for using configuration variables for parameters that change often or within a built application.

The attached file contains my program and an example directory that demonstrates its use.  It even demonstrates how two definitions for the same constant are handled.

While the program achieves basic functionality, it is far from polished.  There is very minimal error handling, some modules/toolkits might not be supported (though the recently disclosed traverse function probably would address that), and the program architecture was designed for simplicity rather than flexibility and future expansion.

Message 5 of 170 (36 Views)

Re: LabVIEW Scripting Main Board

Another LV Scripting blog post:

LabVIEW Scripting Tip #2:  Supporting Undo

-D

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Message 6 of 170 (36 Views)

Re: LabVIEW Scripting Main Board

I am playing around with scripting and have managed to programmatically create a new enum type definition. I would now like to put instances of that type def on the block diagram but without first saving it. It works fine if I save it to file and then I create a new object by specifying the file path. I tried to wire the VI Name (string) of the type def in memory to the path input of the New Object function, which seemed to work but I then get an error that the object could not be created.

Any idea if I can create an instance of a custom typedef without first saving the new type def?

0 Kudos
Message 7 of 170 (36 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

I am playing around with the examples and have noticed that the examples use the BD.Open and BDWinBounds. But when I click on the node the only thing I can see for the Black Diagram is the Status. Do I have scripting installed correctly. Is this still a hidden item. Is ther something else that I need to do.

thanks,

Joe

0 Kudos
Message 8 of 170 (36 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

I've just started making my first scripting experiences and so far I have realised I have a lot to learn.....

I'm trying to write a small tool to automate creating a new VI by modifying an existing VI.

What I want to do is simply replace the control within a cluster of the existing VI (and then save under a new name when finished).  I can get a reference to this control (within the cluster), but I don't know how to replace it.

I know we can copy a selection from a FP with the control I want to replace with, but how do we paste?  Or do we have to delete the old control and re-wire everything manually.....

Shane.

Ps Found it: Method of the "Pane" object....

Pps, doesn't seem to work.... 'm selecting the control I want to copy, copying the selection then selecting the control I wish to replace (in another VI) and calling the "paste" method but it adds the copied contents instead of replacing the existing control..... Help?

PPPS, got it working.  Simply select "replace" as a method of the control to be replaced and supply a path to the control to replace it with.  Still, how to replace from a copied selection?

0 Kudos
Message 9 of 170 (36 Views)
Reply
0 Kudos

Re: LabVIEW Scripting Main Board

Is there a way to activate scripting in 8.2? I'm already using it a lot but current methods of accessing properties is not too convenient...

0 Kudos
Message 10 of 170 (36 Views)
Reply
0 Kudos