LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I prevent a LabVIEW executable from automatically running when brought up the first time?

LabVIEW excutables run automatically when started the first time. I need to change my inputs when running the first time. So the first run is useless without changing the input. I tried using the "STOP" command if I do not give an input (or if the input is the default - invalid). This works in stopping the first automatic run. And it works in running after applying the proper input. But it stops further runs. I cannot duplicate the error in the non-executable version. And I need to be able to run the executable about 100 times a day (using it in a production test program).
0 Kudos
Message 1 of 10
(6,629 Views)
Sateesh,

Try going into the source (the VI) and then changing the properties of the VI. File-VI properties-execution, and check if the "run when opened" box is checked. If it is, then u might have to uncheck it and then go ahead and go to the window appearence peoperties and check/uncheck the show run and stop button appropriately so that the .exe shows the run and stop button in order for you to run it when you are ready.

Another way can be using a differnt run button on the front pannel (see the attatchement) which will decide the execution of your program.

Good luck.
Hope this helps.

Parikshit.
0 Kudos
Message 2 of 10
(6,629 Views)
Hi,

The executable builder automatically sets the 'run when opened' by default.
To change this, in the application builder, on the 'VI Settings' tab, select the top level VI and then click
'Edit Build Settings'. A dialog box opens with a list of target settings and actions, click on the action next
to 'Run When Open' and change it to 'no'.

I hope it helps,

Tim

Pari wrote:

> Sateesh,
>
> Try going into the source (the VI) and then changing the properties of
> the VI. File-VI properties-execution, and check if the "run when
> opened" box is checked. If it is, then u might have to uncheck it and
> then go ahead and go to the window appearence peoperties and
> check/uncheck the show run and stop button appropriately so that the
> exe shows the
run and stop button in order for you to run it when you
> are ready.
>
> Another way can be using a differnt run button on the front pannel
> (see the attatchement) which will decide the execution of your
> program.
>
> Good luck.
> Hope this helps.
>
> Parikshit.
>
> ------------------------------------------------------------------------
> Name: Run_when_enabled.vi
> Run_when_enabled.vi Type: LabVIEW Instrument (application/x-unknown-content-type-LabVIEWInstrument)
> Encoding: base64
> Description: Example.....check this out, Sateesh.
Message 3 of 10
(6,629 Views)
If I understand correctly, you start the application clicking on the "Run" arrow each time you want your test program done.
Indeed the Top Level VI runs by default when opening in an application so you can't control the first run. This can't be avoided. Even if you change the setting of the VI in the Application builder to not run when opened, this setting is overridden for Top Level VIs.

You have to rework your user interface a little. Put all your code in a while loop with a stop boolean button wired to the loop terminal. Add another boolean "TEST" and a case statement that will execute the test code when the user clicks on "TEST". In the loop add a small wait of 100-250ms to avoid that the loop runs wild polling the booleans when it is idle.


That is not the usual way to Run an application using the Run button. Usually the application enters in a loop until the user put it to stop with a stop button on the front panel. Then the application terminates and closes its window. That is what the user expects from the standard user interface.


LabVIEW, C'est LabVIEW

Message 4 of 10
(6,629 Views)
I would agree with the previous post ... really the only point of
creating an executable is that you then are not bound by the "one
computer license" of your development system anymore. At the same time
that also implies you have multiple users and, as a courtesy to them, it
might be a good idea to have a "program", not a "hack" ...

just my $.02,

Rudolf
0 Kudos
Message 5 of 10
(6,629 Views)
I agree with Jean-Pierre. That's really the way executables are meant to work. When I build EXEs the user never even sees the FP when its not "running".
0 Kudos
Message 6 of 10
(6,629 Views)

in the build specification go to Source file settings.  choose the source file.  Then choose customize settings.  Then uncheck the run when opened button

0 Kudos
Message 7 of 10
(1,082 Views)

I'm mostly doing development, and haven't built all that many executables, but am intrigued by the question posed here, and by having some who say "You can't prevent the built Executable from running when you start it" and those who say "Just tell the top level VI in the Build Spec to not Run when Opened".  Sure enough, I did this, ran my Executable, it popped up not running and let me set the Controls as I liked them (it's processing some files, so I have to enter the paths to the files).  Once I was RTR (Ready to Roll), I pushed the Run button, the code started up, I pushed the "Start Button" on my Front Panel (the "normal" way to run this is to start it, "fill in the blanks" with files, then push "Start", which checks to be sure you filled-in-the-blanks before continuing).

 

So at least in LabVIEW 2019, you can build an Executable that does not "auto-run".  [Well, maybe that's too strong -- how about "I've built one Executable and tested it once, and it sat idle until I pushed the Run button to start it running ..."].

 

Bob Schor

0 Kudos
Message 8 of 10
(1,074 Views)

@Bob_Schor wrote:

I'm mostly doing development, and haven't built all that many executables, but am intrigued by the question posed here, and by having some who say "You can't prevent the built Executable from running when you start it" and those who say "Just tell the top level VI in the Build Spec to not Run when Opened".  Sure enough, I did this, ran my Executable, it popped up not running and let me set the Controls as I liked them (it's processing some files, so I have to enter the paths to the files).  Once I was RTR (Ready to Roll), I pushed the Run button, the code started up, I pushed the "Start Button" on my Front Panel (the "normal" way to run this is to start it, "fill in the blanks" with files, then push "Start", which checks to be sure you filled-in-the-blanks before continuing).

 

So at least in LabVIEW 2019, you can build an Executable that does not "auto-run".  [Well, maybe that's too strong -- how about "I've built one Executable and tested it once, and it sat idle until I pushed the Run button to start it running ..."].

 

Bob Schor


All this begs the question about why you would do this in the first place.  It would be much more conventional just to build a VI with a state machine where the first state would be to wait for user input.  Unless this was just a simple engineering tool, (e.g., enter two numbers, get a result) which seems like quite a bit of overhead just for running one VI.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 10
(1,051 Views)

@Sateesh wrote:
LabVIEW excutables run automatically when started the first time. I need to change my inputs when running the first time. So the first run is useless without changing the input. I tried using the "STOP" command if I do not give an input (or if the input is the default - invalid). This works in stopping the first automatic run. And it works in running after applying the proper input. But it stops further runs. I cannot duplicate the error in the non-executable version. And I need to be able to run the executable about 100 times a day (using it in a production test program).

WRONG QUESTION!  The correct question is "How do I revise my code so that the User may change parameters and then executes a section of code exacly once whenever a User presses a 'Run Test' button many times until the User closes the exe?

 

The easiest way would be to simply place an Event Structure around the code. Place a While Loop Around the Event Structure. Create Two Boolean Buttons (Latch when released mechanical action.) Configure the Event case with your original code in it to respond to the "Run Test" Button Value Change Event. Add a case to respond to the other button "Stop" value change and this case should wire a TRUE value to the While Loop conditional terminal to Stop the program.

 

That's the simple method....the FP will be locked (by default) While a Test executes and, there is no way to Abort a Test Run (unless you use the Abort button,  please don't)

 

But, if you then look through examples and online training material you'll see how you could improve the code with a Producer Consumer (Events) pattern 😉


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 10
(1,040 Views)