NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

LabVIEW Scripting

VERSION 20

Created on: May 28, 2009 2:34 PM by Jeff Meisel - Last Modified:  Jan 13, 2010 5:07 PM by Jeff Meisel

What is VI Scripting?

VI Scripting enables users to write a LabVIEW program that can generate and inspect LabVIEW code. It exposes many additional VI Server classes, properties, and methods. It allows you to create new VIs, Front Panel controls, Block Diagram objects and wires as well as traverse diagram object hierarchies and modify code.

 

Installation Instructions

For Windows:  Download the Windows installer from this page (XP or Vista).

You need to activate VI Scripting before the feature is available in LabVIEW.

  1. Select Start >> Programs >> National Instruments >> NI License Manager to open NI License Manager.
  2. Expand the Local Licenses, LabVIEW, and Toolkits items to display the Scripting Development item.
  3. Right-click the Scripting Development item and select Activate to open the NI Activation Wizard.
  4. Select the Automatically activate through a secure Internet connection option and click Next. Enter the provided serial number (L12S86758) and click Next.
  5. Follow the remaining steps in the NI Activation Wizard.

 

 

For Mac/Linux: No activation is required (disregard steps 1-5 from above), download the Mac/Linux installer from the following download page.

 

 

Documentation and Examples

Getting Started documentation is located at the following path ...\labview\manuals\VI Scripting Getting Started.pdf

Examples are located at the following path:  ...\labview\examples\VIScripting

  • Drop Add Function.vi – Demonstrates how to create a block diagram object. Programmatically creates a new VI and drops an Add primitive on it.
  • Drop Add Function Inside While Loop.vi – Demonstrates how to create a block diagram object in a nested diagram. Programmatically creates a While Loop, then creates an Add primitive inside the loop.
  • Drop Round Button.vi – Demonstrates how to create a Front Panel control. Programmatically creates a Round Button Boolean control.
  • Drop Digital Numeric Inside Cluster.vi – Demonstrates how to create a nested Front Panel control. Programmatically creates a Cluster with a Numeric inside it.
  • Random Strip Chart.vi – The Random Strip Chart is a common “Hello World” program in LabVIEW. Programmatically generates and runs a VI that writes random numbers to a strip chart in a while loop.
  • Random Strip Chart with Diagram Cleanup.vi – Instead of worrying about the diagram layout while creating objects, this version of the example drops everything at (0,0) then runs the Diagram Cleanup tool programmatically to clean up the block diagram code.
  • Add Control to Connector Pane.llb/vi – Demonstrates how to associate Front Panel controls with the Connector Pane for use as a SubVI.
  • Connector Pane Pattern Reference.vi – This VI is provided as reference documentation. It shows which connector pane pattern number corresponds with which layout, as well as the numerical index for each item in the pattern.

 

Technical Support

As this is an "NI Labs" product, NI will not be supporting LabVIEW Scripting through Applications Engineering.  All technical issues should be posted on the API Community

 

 

 

Future Version Support

 

 

The Scripting API is subject to change between LabVIEW versions. NI makes no guarantees that any feature or behavior associated with the Scripting API will either exist, migrate automatically, or have a functionally equivalent behavior in different versions of LabVIEW.

 

More Resources

Getting Started with Automating Code Development with LabVIEW Scripting

Write a Plug-In for the JKI Right-Click Framework

 

Downloads:
Average User Rating
(6 ratings)




Michael Aivaliotis Michael Aivaliotis  says:

Where do I download it from?

BradyDuggan BradyDuggan  says in response to Michael Aivaliotis:

Looks like we're still trying to get it posted. Check back in a little bit!

NatasaL NatasaL  says in response to BradyDuggan:

The Windows installers have been published ... sorry for the delay

Mac and Linux installer are coming next week.

Jaegen Jaegen  says:

What version(s) of LabVIEW does this work with?  I installed it, but in only shows up under the "LabVIEW 8.6" item in License Manager (not the "LabVIEW 8.6.1" item)

BradyDuggan BradyDuggan  says in response to Jaegen:

It's a known issue. Activating it under "LabVIEW 8.6" will activate it for 8.6.1. Since this was originally an internal license file, we didn't make a new one for 8.6.1.

 

This will work with both 8.6 and 8.6.1

Ton Plomp Ton Plomp  says in response to BradyDuggan:

Somehow I cannot activate this at work.

Is the number of activations limited to one per LabVIEW SN?

The ni.com/activate page show an error, but no activation code is given.

 

Ton

pauldavey pauldavey  says in response to Ton Plomp:

There is a Serial Number in the readme inside the zip file.  Use that instead of your Labview Serial Number.

Brandon Settles Brandon Settles  says:

Can you activate without a secure internet connection? I went to ni.com\activate (the method I normally use), but I can't find it in any of the lists.

BradyDuggan BradyDuggan  says in response to pauldavey:

L12S86758 is the serial number everyone should use to activate VI Scripting

BradyDuggan BradyDuggan  says in response to Brandon Settles:

Currently you can't activate it other than using the secure internet connection method. I will look into having it added to ni.com\activate and will get back to you.

Qia.sky Qia.sky  says in response to BradyDuggan:

I installed but I cannot see it in NI License Manager, I installed LabVIEW 8.2.1,8.5.1,and 8.6.1

BradyDuggan BradyDuggan  says in response to Qia.sky:

Are you using a localized (non-English) version of LabVIEW? I had a report that the license file didn't install to the proper place for someone using the French version yesterday that I'm looking into.

Qia.sky Qia.sky  says in response to BradyDuggan:

I use English Version of LabVIEW, but It seems NI License Manager is not English Version.

BradyDuggan BradyDuggan  says in response to Qia.sky:

What OS are you using and what language is it?

Qia.sky Qia.sky  says in response to BradyDuggan:

Windows XP Englishi Version, but I set the Regional and language to Chinese/China.

BradyDuggan BradyDuggan  says in response to Qia.sky:

Ahh... I think I've got it. The Scripting Installer doesn't detect if you installed the general NI software to a custom location (it finds LabVIEW, but not the general NI folder). Namely, it doesn't work unless the License Manager is installed to Program Files\National Instruments\Shared\License Manager. I will try and correct the installer.

 

Until then, after installing you can copy

Program Files\National Instruments\Shared\License Manager\Licenses\LabVIEW_Scripting_PKG_080600.lic

to whatever location you have the License Manager installed to.

 

Let me know if this works for you.

BradyDuggan BradyDuggan  says in response to BradyDuggan:

Unfortunately, the installer technology we're using can't find the Shared folder if it's in a custom location. Please use the above workaround if you've installed the National Instruments folder to a custom location.

Qia.sky Qia.sky  says in response to BradyDuggan:

Yes, I installed the LabVIEW to D:.

I copy LabVIEW_Scripting_PKG_080600.lic from C:\Program Files\National Instruments\Shared\License Manager\Licenses\ to X:\Program Files\National Instruments\Shared\License Manager\Licenses\, then I can find Scripting Development in NI License Manager.

Thank you for help

But it seems I cannot activate through Internet connection. My connection problem?

Qia.sky Qia.sky  says in response to Qia.sky:

Well Done

It is my internet connection problem. That works, thank you again Brady!

_Chris _Chris  says in response to NatasaL:

Hopefully "next week" is today :-)

BradyDuggan BradyDuggan  says in response to Brandon Settles:

You are now able to activate Scripting through ni.com/activate. Select LabVIEW as the product, then LabVIEW Scripting Development and it should be available for version 8.6 (which will also work for 8.6.1). Use L12S86758 as the serial number. Enjoy!

NatasaL NatasaL  says in response to _Chris:

Thanks for staying on top of it...

 

Mac and Linux installer have been posted: LabVIEW Scripting for Mac OSX and Linux - License Agreement and Download

smercurio_fc smercurio_fc  says:

It's too bad this isn't available for 8.2.

sth sth  says in response to NatasaL:

I downloaded the Mac/linux installer.  It seems that the instructions for linux do not apply at all to the Mac.  They need to be

 

 

The zip file should already be downloaded and expanded in your Downloads folder

 

 

Execute the following commands from a Terminal window:



 

echo -e "XXX:\tTrue" >> ~/Library/Preferences/LabVIEW.app\ 8.6\ Preferences

where XXX is still the secret code until you accept the T&C, so it is not revealed here.

AND

sudo cp -fpR ~/Downloads/VIScripting_Linux/labview/* /Applications/National\ Instruments/LabVIEW\ 8.6/

 

The "Read Me_Mac_OS_X.txt" file needs to be created similar to the "Read Me_Linux.txt" file.

 

NOTE: I do not believe that linux is ever capitalized that is very unlinux like.

Kamocat Kamocat  says in response to smercurio_fc:

Any chance it could be saved for Labview 8.5?

(say, by downloading the trial of Labview 8.6 and saving it for an older version)

Kamocat Kamocat  says in response to Kamocat:

So far it seems to have worked.  (The examples are incompatible, but once converted, the code still works.  I've tested the "drop add function" on LV 8.5 on both Windows and Mac.)

Here's a zip of all the examples, saved for Labview 8.0

http://kamocat.com/archived/VIScripting_8.0.zip

 

(Unfortunately, I only have a 30 day trial of 8.6, so if any changes are made after that point, I won't be able to convert the corresponding examples)

 

However, I did notice that the installer didn't put the VIs on the functions pallette if you had something other than LV 8.6.  I'll look into that, and reply if there's anything unusual.

Kamocat Kamocat  says in response to Kamocat:

Okay, I rezipped it and set it up with the mac instructions.  http://kamocat.com/archived/VIScripting_lv8.0.zip

It now contains:

the application pallette mnu

the examples (compatible down to LV 8.0)

the Labview scripting manual.

 

Windows:

If following the mac instructions do not work, try running the official windows installer, and then follow the mac/linux instructions.

NangSgi NangSgi  says:

Hi pal, after installed it, I cannot set DBL numeric range by Data Entry for each DBL control.

Xploit Xploit  says:

Hi, I'm a bit confused, does this VI Scripting thing works with LV8.5 ?

Ok the exemples have been downgraded to LV8.0 but what about using the VI Scripting thing ?

Sorry I might have misunderstood some of your post sentences ...

 

 

thanks guys !

DFGray DFGray  says in response to Xploit:

National Instruments has released scripting for external use only on LabVIEW 8.6.  If you save VIs written using scripting for a previous version, they will probably work, but thorough testing is highly recommended.  Scripting has been in existence internally at National Instruments for almost ten years, and  it has improved with every version of LabVIEW.  Properties/methods which work in one version are not guaranteed to even exist in a previous version.  The farther back you go, the more gaps there are in functionality and stability.  Be very careful if you back port.

Rolf Kalbermatter Rolf Kalbermatter  says in response to Xploit:

We can be simple here. On non-windows versions you can extract the necessary menu files and add the according ini token and it will work in earlier versions of LabVIEW too.

On Windows the scripting feature is protected by the license manager and unless NI releases a proper license file for earlier versions AND adds those versions to the license server you can not activate it. And I would not hold my breath for this to happen, as they will soon release the next version of LabVIEW and then even support for 8.6 will be dwindling.

Kamocat Kamocat  says in response to Rolf Kalbermatter:

I've had success on Windows by installing it with a trial version of Labview 8.6, and then copying the .mnu files back over to 8.5.

I haven't yet tested it to see if it's still valid after the trial expires.

If you'd like to try it on Linux or Mac (which you can't get the trial lv8.6 for), I've backsaved it to LV 8.0 right here:

http://kamocat.com/archived/VIScripting_lv8.0.zip

Rolf Kalbermatter Rolf Kalbermatter  says in response to Kamocat:

This would work for the menu file but not for the entire VI Server Scripting object hierarchy. The properties and methods as well as menus for selection of VI Server classes are build at startup based on the licensed availability of scripting. And this license is version dependant so I would not see how you can get this working in LabVIEW 8.5 with a LabVIEW 8.6 scripting license.

Yukee Yukee  says in response to Rolf Kalbermatter:

Wow, Nice feature I like. I can dump LV7.1 away now.

CaoWJ CaoWJ  says:

hey,

I've had success on windows by installing it with LabVIEW 8.5 downloaded the  http://kamocat.com/archived/VIScripting_lv8.0.zip to my examples files.

everything is cool,but I found the invoke node Relayout is invlid and vi is borken.

 

why?

 

thanks guys!

Rolf Kalbermatter Rolf Kalbermatter  says in response to CaoWJ:

Well as has been stated many times already, the LabVIEW API is a highly evolving technology. That means some properties that work in 8.6 will simply not be there in earlier versions or they may be there but always return a runtime error, or they may do something different than they do in 8.6. Even now with scripting released NI reserves the right to change this API whenever they want in newer versions.

 

And while you can of course open VIs that use scripting in earlier versions, that is quite different than dropping a property or method node and being able to select one of the LabVIEW API properties or methods from the drop down list. Without activated license those properties and methods are simply not there to select. If you happen to have an existing node somewhere in a VI you can always copy/paste that but you can not make a new node.

 

Rolf Kalbermatter

BradyDuggan BradyDuggan  says in response to CaoWJ:

The simple answer is that the Block Diagram Cleanup tool didn't exist in LV 8.5. It was a new feature in 8.6.

John80 John80  says:

Any info on how to use VI Scripting with LabVIEW for FPGA? I installed the VI Scripting package as outlined above, and I could not find any of the FPGA-specific VI's listed when trying to create an object using the VI Scripting VI's.

 

Thanks in Advance!

 

Otherwise I think VI Scripting is awesome and I can't wait to use it for so many other things....

DFGray DFGray  says in response to John80:

FPGA nodes are built on a different technology than other primitives.  This makes scripting them difficult, even for us behind the curtain, and the methods change with every version of LabVIEW, making porting from one version of LabVIEW to another hard.  Short answer - don't go there.

John80 John80  says in response to DFGray:

I see, thanks for the response.  Well, let me tell you about what I am working on, and how VI Scripting would be of great assistance to me and to others in similar situations....

 

I am trying to speed up Matrix Math by using LabVIEW for FPGAs, during NI Week, I learned that using memory is more efficient than using FIFOs for my specific situation, so I had this really large VI where I manually cut and paste 65 FIFOS, 65 FIFO create VIs, 65 Fixed Point Math Add functions, 65 Fixed Point Math Multipliers, and created 65 shift registers for all the values.  I then set it to compile, and after 6 hours I learn that it doesn't fit on the chip!  So, I cut it down to 50 FIFOs, and it worked, but how much more can I squeeze onto that FPGA? What if I want to change my precision requirements? Either way... that would be real painful.

 

Thankfully though, now with LabVIEW 2009 I at least get a good estimate of whether something will compile before I start that long process.  As for VI Scripting for LabVIEW FPGA, any support, whether it be for LabVIEW 7.1 would be a great tool and greatly appreciated by all!

BradyDuggan BradyDuggan  says in response to John80:

If you can't drop FPGA functions through Scripting  (which you can't, unfortunately), you may be able to acheive what you need by using Scripting to just do the copy/paste for you. Configure one of the nodes the way you want it, then use TopLevelDiagram::MakeSelection, ::CopySelection, and ::PasteSelection to change your code and then wire it back up or possibly GObj::Replace so you don't have to do the wiring yourself.

 

If you're wanting to change anything about the node that you'd usually have to double-click it and bring up it's configuration dialog to do... then you're out of luck doing that through scripting. However, nothing should be stopping you from dropping a node once and configuring it by hand, then copy/pasting it through scripting. (well... at least nothing that I know of. The FPGA nodes are pretty darn special under the hood, so I won't be too surprised if you hit a different snag, but it could be worth a try)

DFGray DFGray  says in response to BradyDuggan:

Brady is correct.  You can copy and paste existing code.  No guarantees about what the sanity checking under the hood will do, but it usually works.  Note that a much faster method is to use the Move method to get code, especially FPGA code, from one VI to another.  If you have more than one object, wrap the code in a single frame sequence (which is easy to move) and remove the sequence after you do the Move method.

TomiM TomiM  says:

Package for LV 2009 on 32-bit Vista seems to work properly on 32-bit Windows 7 as well. After several weeks of experience, I am starting to like  Windows 7 a lot

labviewbruce labviewbruce  says:

Hi, This scripting tool is very useful for configurable code generator.

But after using VI scripting I found that there isn't enough supported document .

Although there are examples, getting start doc and node descriptions, My colleague and I are a little disappoint at trying all the functions of these method or property nodes since there is no detail descriptions for each one of them.

Where could we get these supported documentations if there is any? And if there is not then how long should we wait?

Thanks~!

After all the complains above, I do love the abilities of scripting~!

DFGray DFGray  says in response to labviewbruce:

Welcome to the scripting club!  National Instruments released scripting essentially as is.  It is not a commercial product, hence the severe lack of documentation.  Support is through this forum.  We welcome your questions and comments.  If you find something you can not do, let us know, so we can add it to the list.

 

You can do almost anything if you know how.  Unfortunately, the "how" can sometimes be extremely non-obvious.  Ask and you will recieve...usually.

 

We are working toward a commercial release.  When and if it occurs is still undecided (i.e., it will be ready when its ready).

Jeffrey Habets Jeffrey Habets  says in response to DFGray:

You can do almost anything if you know how.  Unfortunately, the "how" can sometimes be extremely non-obvious.  Ask and you will recieve...usually.

 

I'd like the InsertNode method to behave the same way as a native insert in LV behaves, so that it also works as expexted on wires with multiple junctions/bends. It would probably need a position input of some kind for that, or we would need a more complete interface for wires (e.g. WireSegment class). Now, if I want to have the same behaviour for inserting a node into a specific wire segment, my only option seems to be to delete the wire and recreate it from scratch.

More Like This

  • Retrieving data ...