LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to tell if VI is running?

I've written a "Start VI" routine that probably looks like the one most others have written -- it takes a string, opens a VI Reference, opens the Front Panel using a VI Property Node, then runs the VI using a VI Invoke Node.  I was doing some "manual testing" (i.e. single-stepping to see "what went wrong") and found that if the VI was already running when the caller ran the Start VI code, the Invoke Node generated an error, code 1000, string "Invoke Node in UTIL Start VI.vi".  The "obvious fix" is to first test if the VI is already running before trying to use the Invoke Node to run it again, but I can't figure out how to do this!  [The other, much less satisfactory fix, is to simply ignore the error ...].  None of the VI Properties seem to be appropriate, but I probably missed the obvious, and would appreciate a "clue".

Bob Schor
0 Kudos
Message 1 of 5
(3,038 Views)
Use the propertiy node for VI's, one of the properties is Execution State. 0 = bad vi (not executable), 1 = idle, 2 = running top level, 3 = running.







Message Edited by StevenD on 06-10-2008 08:11 AM

Message Edited by StevenD on 06-10-2008 08:12 AM
0 Kudos
Message 2 of 5
(3,032 Views)
You can use the VI Property "Execution.State" to get this information. But better is also to know if you started it or not without to use this property.
0 Kudos
Message 3 of 5
(3,031 Views)
Have a look at the "Execution State" property of the VI. You can check whether it's "Run top level" or "Running".

Hope this helps,
Daniel

0 Kudos
Message 4 of 5
(3,029 Views)
Thanks, everyone.  I did, of course, look at the properties, saw "Execution", but overlooked "State" (everything else seemed to be governing how it executed, not if).  Sigh.

BS
0 Kudos
Message 5 of 5
(3,008 Views)