From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically determine if vi started with Run button


@paul_cardinale wrote:

wiebe@CARYA wrote:

@paul_cardinale wrote:

wiebe@CARYA wrote:

@paul_cardinale wrote:

@TeraTech wrote:

I've always been confused by how the LV documentation uses the term "target" since, at least from my perspective, a PC can also be a deployment target. Thanks for chiming in on that.

 

Why would I want to know this?
Sorry, I forgot to mention my need... First, I know that I can distinguish a vi running in an exe from development with the Application:Kind property. That is not what I was searching for.

 

I basically need it for standalone testing of a vi. I have a very "modular" application with many "sub systems". After writing a new vi or modifying an existing vi, I often want to test it without launching my entire application then have to run it trough its paces just to get to a test scenario in place for that vi. In the edit mode I am able to run (run button) various top-level module vis (subset of all the modules in the application) to produce data, then run (run button) the vi I want to test to consume the data for testing and debugging.

 

@Paul- The Execution:State is a good idea and cleaner that using Call Chain and the checking array size, but it seems to suffer the the same issue - not being able to distinquish running standalone (run button) vs being loaded and run dynamically.

 

I realize I can throw together a quick and dirty test project with only the modules I need, but being able to just run the modules, then run my vi-under-test is much simpler and quicker. It's also more convenient to leave my supporting modules running start and stop the vi I am working on.

 

I could also simply add a front panel Boolean called Test Standalone and check it in the code vs calling Call Chain... but then I have to remember to un-click it when I finally do run my entire system.... which I have done numerous times and have to shut down my app and restart.

 

As mentioned the Call Chain function work great (as would the Execution:State property), unless the vi under test is loaded dynamically. So perhaps another way to state the question, is there a way tell if a vi was dynamically loaded?

 


Did you try "True Run State"?


VI don't need to show the toolbar while running.

 

It also doesn't distinguish between starting the VI manually, and starting it dynamically, which is the point.


  1. It puts the toolbar visibility back to its original state.
  2. It does distinguish between starting the VI manually.

Not for me. When I start a VI dynamically, it reports running top level, when I run it, it reports running top level. Except when it fails, apparently when the toolbar isn't initialized.

 

Why would it be able to detect the difference? The icon that you're using looks exactly the same for a VI started manually and one started dynamically. 

 

Here's two VIs that simply run infinitely, one started manually, the other dyncamically:

Run Icon.png


OK.  I was using "Call By Reference".  It works with that.


Call By Reference is much like calling a sub VI. The run method is much like calling the VI manually.

 

Sadly there is lost of differences that make dynamic life very, very hard.

 

CBR (and variations) require the connector pane.

 

Run method can only be used if the instance isn't running (like manually running it).

 

There's no way (yet) to call a Vi that is running, when you don't know the connector pane. This is silly, because if you make a new VI, and put the Sub VI in it's diagram, you can run it even if it is running.

 

See Run As SubVI method idea.

 

Another major difference is that the run method needs an idle root loop. So it stalls if you open any menu. *Sigh*.

0 Kudos
Message 21 of 21
(236 Views)