LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running same terminal without closing it

Hi all,

 

I have been thinking about how to run "system execute VI" so that once I have opened it, then afterwards I can pass new command lines to the same terminal. By using the command  "cmd /K" it keeps the window open, thus I can't figure out how to continue further.

0 Kudos
Message 1 of 3
(1,177 Views)

@Lawi0 wrote:

Hi all,

 

I have been thinking about how to run "system execute VI" so that once I have opened it, then afterwards I can pass new command lines to the same terminal. By using the command  "cmd /K" it keeps the window open, thus I can't figure out how to continue further.


I don't think you can.  But what is the advantage of doing this compared to just opening it when needed?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 3
(1,151 Views)

@Lawi0 wrote:

Hi all,

 

I have been thinking about how to run "system execute VI" so that once I have opened it, then afterwards I can pass new command lines to the same terminal. By using the command  "cmd /K" it keeps the window open, thus I can't figure out how to continue further.


You can, but not easily. Basically the command line tool reads from the standard input and outputs to the standard output and standard error. Normally they are connected to the terminal session in which the command line executable is executed. There is a way to connect pipes (an OS facility) to each of those IO streams and then redirect the input and output to these pipes. This has to be done before spawning the executable so you can't easily do it after the fact when SystemExec has executed. 

 

I did in the past develop a library for the OpenG project that supports pipes. It's latest archive is currently still in the sourcetree of the OpenG project: https://sourceforge.net/p/opengtoolkit/svn/HEAD/tree/trunk/lvpipe/pipe.zip

 

Please note a few things however: This was developed for my own use and did what I needed it to do but was never fully tested with all kinds of corner cases. I know of several people who successfully used it themselves and still do, so it works in many cases but there are potential gotchas. Also that archive only contains a 32-bit build of the needed shared library. While the DLL will work if you use it in 32-bit LabVIEW for Windows, it will not work in the 64-bit version of LabVIEW. And the shared library file for Linux in there is just a placeholder, the real build was never added to that archive and wouldn't make much sense nowadays as LabVIEW for Linux is 64-bit only since about LabVIEW 2016 and would need an according 64-bit build for that shared library to work. But LabVIEW for Linux and MacOS X has native support for pipes, so this library doesn't add much to that on those platforms anyways.

 

There are also people on this forum who developed something similar based on .Net. Their solution may be more supported on current Windows versions than the OpenG library. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 3
(1,139 Views)