LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock-ups using SystemExec.vi

I'm still working with the following problem:

//////////
Okay, I'm creating this VI in LabVIEW that uses SystemExec.vi to run an external, DOS-based program. However, this external program needs input after output of the first segment of text. The input is found using a small Call Library Function, but is BASED ON what the program outputs during its first segment.


So, if you couldn't tell already, I'm having a problem getting the output of the first segment into LabVIEW so I can work with it. In SystemExec.vi, when I set "Wait Until Completion?" to "false", there is no output from the sub-vi. Thus, I can't work with it.


Basically, during the whole execution, I need to have LabVIEW able to interact with the progr
am. But it looks like the program outputs to ONLY ONE device, either the console or LabVIEW. Any suggestions?
//////////

//////////
Hi Bonhomme-

We have to get a little creative here.
Any command line's output may be redirected to a text file with the ">" (e.g. 'ping www.ni.com > benschulte.txt' outputs to benschulte.txt).


1. So you launch your exe with SystemExec
2. Redirect the output to a text file
3. Read the text file in LabVIEW and proceed


Hope this helps.


ben schulte
national instruments
//////////

Alright, here's the thing. Before I can even write to a text file, the program has to finish executing. Mine cannot because it requires some type of input based on what it output from the first segment. So I have to analyze the output and then send something back in. I cannot do this by writing the output to a text file since there will be no output since the program is not complete. Is this even possible to do? Thanks.
0 Kudos
Message 1 of 2
(2,669 Views)
Hi Bonhomme,

This is going to try my memory, so forgive mistakes please.

In the same way output can be redirected from a DOS program, input can be re-directed as well.

So idea follows.

Write .bat file that runs your DOS app.
On next line of bat file, include answers DOS program needs (end with CR).
Use the other Ben's idea to get the results you need.

A pretend example follows.

Dos_Prog_name>results.txt
answer_1
answer_2
exit

If the answers are dynamic, you will have to create this .bat file on the fly.

Ben

P.S. At this point, you may want to let us know what the DOS command syntax looks like, and where things get complicated. We may be able to be of more help.
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 2
(2,669 Views)