LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you send info out of System Exec if calling a Labview Executable

I am trying to use the System Exec VI to call a Labview exe file (Yes, I've already tried the DLL option, but I have other issues so this was the next best thing).  I already know how to pass in arguments from the command line, but how can I output data (string format) from the exe through the System Exec VI's "Standard Output" terminal?  Is there a setting anywhere?  I didn't see anything in the invoke or property nodes.

 

0 Kudos
Message 1 of 8
(3,794 Views)

Hi Trouble,

 

The Standard Output terminal will return information from the program you call as long as the wait until completion terminal is set to true.  Wire a true constant to the wait until completion and the output of the program will be returned.   If you don't wire a true constant to the terminal, the Standard Output will be a blank string.  

 

Hope this helps,

 

Starla T. 

0 Kudos
Message 2 of 8
(3,758 Views)

I don't know how to make a LabVIEW created exe behave like a DOS program and write to the standard out.

You could write to a file inside the exe and then read the text in the calling VI.

 

 


Trouble wrote:

 

Yes, I've already tried the DLL option, but I have other issues so this was the next best thing). 

I have to ask what issues did you have with creating a DLL with LabVIEW as that would be the best way and would give you more control and flexibility. System Exec is good when there is a existing DOS program that you did not write but need. If your are the one creating the code, a DLL is the way to go.

 

Omar
0 Kudos
Message 3 of 8
(3,751 Views)

This has been discussed before and I believe this Lava post gives an example of a VI that can write standard output to the commandline window that it was ran from.

 

http://lavag.org/topic/11719-running-a-labview-exe-from-the-console/page__view__findpost__p__71087

 

One suggestion in the next post in that thread was to use the command cmd /c myapp.exe when running the LabVIEW app.

0 Kudos
Message 4 of 8
(3,741 Views)

The problem I am having is the DLL crashing.  I am trying to communicate with the sbRIO module using only two Network shared variables (send & receive).  I simplified the VI in the DLL to its simplest form, and even though it ran longer, it did still crash.  By crash, it either locks up Labview so that I need the task manager to kill it or labview just instantly disappears without warning.  I can run an .EXE file all day, but the DLL will crash at random.  I'm still working on the code located on the RT target and trying to optimize the performance there, but I'm not having much luck yet.

0 Kudos
Message 5 of 8
(3,725 Views)

Are you building a LV vi into a dll and then calling it from LV?  That sounds unusual...could you give us more detail on your application?

0 Kudos
Message 6 of 8
(3,684 Views)

The DLL allows the code to be more portable and easier to program from an upper level.  Also, since I am using the RT and FPGA applications, the development person using this code doesn't need the licenses, if I keep it as a subVI, then licenses are required.

 

Anyway, I think I figured out the root cause of my problem with the DLL.  I am using Ethernet and the Network Shared Variables to communicate with the RT target (sbRIO).  To do that I used a USB-Ethernet adapter on my PC since my only port is connected to the company network.  Once I removed the adapter and connected directly to the back of the PC, the crashes went away.  We are going to try adding a PCI-Ethernet card to the computer instead of the USB adapter to make sure that it will still work.

 

Thanks for the responses even though I don't think the original question was answered.  I guess for now the answer is 'not possible' (at least until the next version of LV, right!?Smiley Wink).

 

Jeff

0 Kudos
Message 7 of 8
(3,674 Views)

Hoovahh - Sorry, I missed your response.  I just checked out the example, very interesting.  Not sure how I would implement it yet especially since I need a solution in 8.6 not 2009, although it looks basic enough to redo in 8.6.  But since I think I solved my issue, it will have to wait for another day.  Thanks for the response.  Smiley Happy

 

Jeff

0 Kudos
Message 8 of 8
(3,670 Views)