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 can I make a VI run when automatically when it is opened?

I am looking to save a VI so that when the file is opened in LabView, it will automatically start running. I don't want to make the end user have to click a "RUN" button, as I have a "Power" button that is default on.

If there isn't a way to do that, is there a way to sync the LabView "Run" button with a boolean control? That way, when the run button is pressed, my boolean will go "true". It is already set so that when the boolean is pulled false, the vi stops executing.

Thanks,
-Evan
0 Kudos
Message 1 of 5
(2,543 Views)
I forgot to ad another thing about syncing the run and power button. If my power button is pressed to go "True", the VI should begin to run...

Is this even possible?
0 Kudos
Message 2 of 5
(2,543 Views)
Go to VI Properties>Execution and check the box labeled Run When Opened. If your power button is wired to a case statement, then the false case should be empty and the true case should contain whatever code you want to run. I'm also assuming that the power button and case statement are inside a while loop. If it's not, create the while loop so that the program can keep checking the status of your power button.
0 Kudos
Message 3 of 5
(2,543 Views)
Thanks for the help on the "run when opened" issue. That was what I was looking for.

I do have the button wired to shut off the vi when the power is depressed (false).

Is there anyway to make it so that when I press the power button (change from false to true), after the vi has been stopped, that I can make it excecute.

for example- I want to start the vi by only pressing the power button. Not the RUN button.

I don't know if that made sense or not.
0 Kudos
Message 4 of 5
(2,543 Views)
....

> for example- I want to start the vi by only pressing the power
> button. Not the RUN button.
>

The question is understood. There is no way to tie another button to be
equivalent to a run or abort. I think what you want to do is to keep
the VI always running. It is either in standby mode or it is collecting
data. Think of this a bit like an electronic circuit. Your machine can
be in many modes, but you always want a battery in the circuit so that
your machine is operable.

Design a state into your app that does nothing but monitor the important
buttons. There is some way to enter that state, and some ways of
leaving it and going off to do other things. Everything will fall into
shape when you structure your a
pp this way.

Greg McKaskle
0 Kudos
Message 5 of 5
(2,543 Views)