LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find out if an external program is running

I am using LabVIEW 8.6 and have some vis that start an external program using the System Exec call. The program that is being started was not written by me, and I have no control over it. I need to make sure that it is started before I proceed, but I don't want it started more than once. At the moment I need to terminate it manually when I exit the vi. I also need to make sure that it is not running when I start the vi or I will get two copies. I have a switch to prevent  this, but it requires manual inspection and control every time I start the vi. I would like to know if there is some way the vi can list all the programs running and start the external program only when necessary. Closing it at the end would also be nice, but not as important as starting it once and only once. If I had control over the program I could use the existence of a file to tell me if the program is running or not, but that isn't possible. Is there some tricky way to use stdout in the System Exec call to accomplish the same thing?

 

Rich

0 Kudos
Message 1 of 4
(2,394 Views)

Nothing tricky about it. Just use the command appopriate for your OS. For Windows:

 

Then just use the Match Pattern function (for example) to search the string. 

Message Edited by smercurio_fc on 03-02-2009 01:52 PM
Message 2 of 4
(2,381 Views)
I neglected to mention that Wait Until Completion is False because the program must continue running while my vi is running. That means, as far as I can tell, that standard output produces nothing.
0 Kudos
Message 3 of 4
(2,372 Views)

I understand your response now. Run a separate system exec asking for the task list and examine the results. That  should work.

 

Thanks

0 Kudos
Message 4 of 4
(2,368 Views)