06-14-2024 10:59 AM
I have a simple vi that I want to perform an action when I run it. I used application builder to create an executable. In the Vi Properties, I have the vi set to "close afterwards if originally closed". I figured that would mean that if I run the executable, even if the front panel does appear it would close itself upon sucessful running/completion of the vi. However, every time I run the exe the front panel appears and just stays there. This is a function I intend to run multiple times (think of it as a macro), so if I have to close out of the front panel manually each time I will get frustrated real fast. I tried changing some of the vi settings around but nothing really seems to be doing it.
Any help would be greatly appreciated.
Apologies, as I'm sure this is a simple thing that I am missing.
Thanks.
Solved! Go to Solution.
06-14-2024 11:04 AM - edited 06-14-2024 11:05 AM
Are you talking about the panel of the toplevel Vi or a subVI?
If this is a subVI, what makes the front panel appear?
06-14-2024 11:08 AM
It is the toplevel Vi that pops up. There are subVIs in this program, but their panels do not pop up.
06-14-2024 06:20 PM
Add this to your VI.
Programmatically Exit or Close a LabVIEW Executable
06-17-2024 08:05 AM
Ok yeah, this seemed to work. Thank you!
Is this how all executable level VIs should be set up, if they are supposed to just fire and forget like this?
I guess the question I'm asking is, is this method a bandaid fix or a cure for the itch?
06-17-2024 09:04 AM
Hi JBat,
@JBatSRO wrote:
Is this how all executable level VIs should be set up,
Yes, it is.
When your executable is about to stop it should call the QuitLabVIEW function as the very last step…
Suggestion:
Create a subVI, where you check the environment (EXE or IDE). Depending on this check you call either Quit or Stop function. Put this VI into your user lib and call it in all your main VIs as last step…
06-17-2024 02:44 PM
Ok, great, this is all very good to know. I implemented the vi quit and it worked exactly as i needed it to. I will have to see where else in my other VIs in other projects this will be effective.
Thank you all for your help!
06-17-2024 04:49 PM
@GerdW wrote:
@JBatSRO wrote:
Is this how all executable level VIs should be set up,
Yes, it is.
When your executable is about to stop it should call the QuitLabVIEW function as the very last step…
Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.
I use an occurence to fire the LabVIEW quit/exit only if the program is hanging. If the occurence does not occur within a set period of time, then fire the Quit LabVIEW; otherwise it should shutdown normally like any other program. Below is a mockup; of course the code needs to reach that point in execution for this to work.
06-18-2024 12:29 AM
Hi mcduff,
@mcduff wrote:When your executable is about to stop it should call the QuitLabVIEW function as the very last step…
Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.
I agree on the "crashing a car" comparison - when there is a STOP/QUIT somewhere in the middle of program execution. But I wrote "as the very last step"…
06-18-2024 07:26 AM
@GerdW wrote:
Hi mcduff,
@mcduff wrote:When your executable is about to stop it should call the QuitLabVIEW function as the very last step…
Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.
I agree on the "crashing a car" comparison - when there is a STOP/QUIT somewhere in the middle of program execution. But I wrote "as the very last step"…
So then it acts as a "failsafe" closing LabVIEW as a last resort if some weirdness is keeping it open?