LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

command line execution and gui execution in paralell

Is it possible to setup a program to run through command-line interface, and control this program via the command-line while also having it open for control via user interface.  If I understand correctly, setting a program to run through command-line interface precludes it from being controlled in parallel via user interface (i.e. having it open in labview like regular).  I appreciate all feedback.

Cheers!
0 Kudos
Message 1 of 12
(4,857 Views)
Are you trying to open a second instance of the same program while you have launched one from the command line or are you trying to open a VI from the command line (passing in some initial values) and then have control over it in a regular LV environment?
David_B
Applications Engineer
National Instruments
0 Kudos
Message 2 of 12
(4,813 Views)
I think he wants to be able to send commands to an already-running instance via the command line.

I've often thought of something like this, but am still a bit unsure as to how this should be performed.  I have little experience in inter-process (seperate EXEs) communication.

I think you need a second small program to "inject" commands to the main program instance, or an intelligent program which detects if it's already open and reverts to "inject" mode if it detects an already open instance.  I don't even know if the second idea is even possible....

Shane.
0 Kudos
Message 3 of 12
(4,793 Views)
My question has evolved a bit since I first asked it.  This program will be running under linux, I would like to have the user start the program (with labview already running) and send input values via command line, I would also like to have the output returned to the command line.  I am thinking of making these outputs available via shared variables and having a second program running that will display the outputs as a GUI.  My question is how easy is it to have Labview up and running the second program => user starts and sends inputs to first program via command line => first program executes sends output back to command line as well as to second program through shared variable and then first program exits?  For this to work does the first program need to be compiled as an executable?

Thank you for your help
0 Kudos
Message 4 of 12
(4,775 Views)

It seems like you should be able to do this with either an executable or VI.  Using Command Line Arguments with a LabVIEW Executable shows how you would pass these commands in.

Once you have these parameters passed in to the VI or the EXE, then using shared variables to pass the information to other VIs and having the first VI exit once communication is finished seem like fairly simple implementations.



Message Edited by David_B on 04-02-2008 04:59 PM
David_B
Applications Engineer
National Instruments
Message 5 of 12
(4,750 Views)
Just to reiterate, I should be able to send command-line arguments to a VI (not an executable)?  and this process will run be fine on a Linux machine? (I was worried that command-line may be something only used for Windows, built with an API...)?  I appreciate the help!

Thanks!
0 Kudos
Message 6 of 12
(4,739 Views)
You should be able to do this with a VI using the syntax shown in the above-linked document (C:\Program Files\National Instruments\LabVIEW 8.0\LabVIEW.exe c:\test.vi –– 1000 sine).
 
As for the linux limitation, I only saw that this would be a limitation in Unix systems and I don't have a Linux system handy to verify that it can be done in Linux.  Be sure to post any trouble you run into about it.
David_B
Applications Engineer
National Instruments
0 Kudos
Message 7 of 12
(4,735 Views)
Just wanted to update.  I have had very good success with launching and sending input to my program via command line (ala the shipping examples CommandLine.vi and Description.vi).  One question I need answered though: is there a way to pipe data out of my vi and back to the command line?  One of my applications needs to communicate to temperature sensor and I would like to be able to send the temperature read through the vi back to the command line.  I welcome any and all info.

Cheers
0 Kudos
Message 8 of 12
(4,627 Views)
A second question.  Using the command line to launch my program causes the command line to wait until LabVIEW is closed before it regains focus.  Currently I am closing labview after each command line call, is there a way to return focus to the command line without exiting out of labview?  It is inconvenient to have to wait for LabVIEW to open and close with each command line sent.

Cheers!
0 Kudos
Message 9 of 12
(4,607 Views)

On the first question:  How about using the 'echo' command?

David_B
Applications Engineer
National Instruments
0 Kudos
Message 10 of 12
(4,565 Views)