Reference Design Content

cancel
Showing results for 
Search instead for 
Did you mean: 

Wiresmith Technology: LabVIEW Command Line Interface (CLI)

A proxy mechanism to allow LabVIEW programs to easily write out to the command line.

 

Libary and component shared by Wiresmith Technology.

 

 

Source Code and Documentation:  https://github.com/JamesMc86/LabVIEW-CLI

 

CLI.png

 

Questions and comments about the code itself, should be posted to the Github repository of the code: https://github.com/JamesMc86/LabVIEW-CLI/issues

authored by
Christian L, CLA
Principal Systems Engineer - Partner and Ecosystem Development - National Instruments
  
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code, and use of the Code is subject to the Sample Code License.
Comments
Member JoeWork
Member

The link to your source code doesn't work.  It appears to have added an extra http to the link.

Active Participant Christian_L
Active Participant

Thanks. It has been fixed.

authored by
Christian L, CLA
Principal Systems Engineer - Partner and Ecosystem Development - National Instruments
  
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code, and use of the Code is subject to the Sample Code License.
Member chinghwayu
Member

I tried this but it looks like there's a bug passing command line arguments to LabVIEW. For example:

"c:\Program Files (x86)\Wiresmith Technology\LabVIEW CLI\labview-cli.exe" "C:\Documents\GitHub\LabVIEW-CLI\LabVIEW Source\CLI Demo.vi" -- "This is a test"

Doesn't pass "This is a test" as a single argument. Instead, it passed each word as a separate argument.

CLI Demo.PNG

Active Participant James_McN Active Participant
Active Participant

Yeah that was a silly omission. I'll take a look at it over the next couple of days!

Cheers,

James

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are atdevs.wiresmithtech.com
Active Participant James_McN Active Participant
Active Participant

I've put a fix in and you can find it in the v1.1 release on github (https://github.com/JamesMc86/LabVIEW-CLI/releases/tag/v1.1.0-beta)

Hope that works for you, let me know how you get on!

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are atdevs.wiresmithtech.com
Member chinghwayu
Member

Thanks for the quick turnaounnd! Looks like it's working. I've got some ideas to put this into good use and will try to update with some details if it works out.

Member endeavor
Member

Hello James,

thanks for sharing this awesome tool!

I'm having an issue with running a VI, namely labview-cli is only able to launch LabVIEW and open the VI but not to start it. If I run it manually afterwards it works fine, i.e. can communicate etc.

I'm using LabVIEW 2014 on a 32-bit machine. My command string looks like this:

"C:\Program Files\LabVIEW-CLI\labview-cli.exe"  -v --lv-exe "C:\Program Files\National Instruments\LabVIEW 2014\LabVIEW.exe" "C:\...\LabVIEW Source\CLI Demo.vi" -- "This is a test"

Few more observations which can be useful (or useless):

  • the default LabVIEW path won't work for 32-bit OS
  • in case path to the VI is incorrect, no error will occur and labview-cli will be waiting for connection; however if you make a typo in the VI extension, LV will immediately tell you that it's not supported even if the VI doesn't exist at all
Active Participant James_McN Active Participant
Active Participant

Hi,


Thanks for giving it a go. You are correct about the VI not running immediately. The way I have worked with this is to set the VI to run when opened in the VI execution properties, this is the best way to get autorun behaviour from the command line. Anything more needs VI server which is a much bigger job!

I'm pleased to say some of your other feedback is being addressed. rose-a on github has created the code to get the exe location just from the version number which makes it much more friendly. This code is on github at the minute and I will build a release once a few more items are in.

As you can guess from the other I do some basic extension checking (to decide whether to launch as an executable or vi). We can probably add some checking for validity as well

Thanks again!

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are atdevs.wiresmithtech.com
Member endeavor
Member

Thanks for the explanation. I've set it to Run when opened (this option wasn't checked before) and naturally it works. Cheap and smart!

Great to know you're working on improvements, although the issues I've noticed so far are kind of minor comparing to what the tool brings to those who are excited about Jenkins or any other CI software. Thank you and everyone who's involved, your work is highly appreciated.

Active Participant James_McN Active Participant
Active Participant

There are some excellent improvements now posted on github. I highly recommend the latest version which fixes most of the problems reported and some others.

Main great improvement is auto-detection of LabVIEW install paths as well as general robustness. Download it at https://github.com/JamesMc86/LabVIEW-CLI/releases/tag/v1.3.0

(P.S. most of this was implemented by rose-a so thank him, beauty of open source at work!)

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are atdevs.wiresmithtech.com
Member joerg.hampel
Member

James,

 

just wanted to leave a note to let you know how well your tool works with my Gitlab CI. Releasing my software fully-automated as of now!

 

V1.4.0 really "kills it" ;-) ;-)


Joerg Hampel, CLA | hampel-soft.com
Active Participant MattP
Active Participant

I have a set of build steps, with accompanying groovy scripts, for this tool that I posted here: http://forums.ni.com/t5/Reference-Design-Content/Common-Continuous-Integration-Steps-for-LabVIEW-Com...

 

Hopefully can save others some time.

Cheers,

Matt Pollock
National Instruments
Member mattyG
Member

James, Thank you for sharing this tool!

 

I am calling a compiled Labview executable with the Labview-CLI tool. (ex: labview-cli myApp.exe -- myParameter)

 

It works perfectly on a machine that has both the Labview Runtime and any version of Labview development environment. Unfortunately, it does not work on a computer that has only the Runtime Engine installed. I get this error "No LabVIEW.exe found..."

The problem is the following. Since I am calling an executable there is no need to check for the installed Labview versions and for LabVIEW.exe. This should be skipped when the launch program is an exe.

Contributors