LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoiding "Run VI" on an already running VI

I want to be able to call a non-running VI to run in parallel with my main VI.  I am thus using this little snippet of code:
I close the reference afterwards because I don't want to have to worry about keeping it open throughout the rest of my program (i.e. put another shift register in my state machine's While loop).

This generally works just fine, except that if this code executes while the other VI is already running, I get an Error 1000, "The VI is not in a state compatible with this operation."  I suppose I could just set up my code to explicitly ignore that error, but that seems a bit sloppy.  Isn't there some node I can use to check if the VI is already running?  If there is, it is eluding me this morning.
0 Kudos
Message 1 of 3
(2,766 Views)

Not sure I recall the exact name, but I there's a property node selection for something like "Run State" or "Execution State".  It returns an enum with (I think) 4 possible values, "Idle", "Run Top Level", "Running", "Bad".   You can verify that the vi is in "Idle" state before trying to run it again.  I'm not sure if you can easily recover from "Bad" at run time -- I think it indicates things like a vi that has pending edits that haven't been saved. 

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 3
(2,755 Views)
Ahh, right you are.  Execution -> State to be precise.

Seems a mite unintuitive.  Oh well.  Thanks anyway.


Message Edited by kehander on 01-31-2008 01:28 PM
0 Kudos
Message 3 of 3
(2,739 Views)