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: 

Can save config file when running VI, but not when running EXE

Solved!
Go to solution

Hi there,

 

I've attached a zip folder containing a LabVIEW project as well as a built EXE.

 

The program will load up the the numeric value from the config file in both cases, but it will only write the config file when it's run as a VI, not as an executable. If I don't use the JKI state machine, I don't believe I see this problem, so I'm guessing it's the order in which the program closes? I tried disabling the front panel close, but that still did not help.

 

The read config file is performed in the "Data - Initialize" case and the write config file in the "Data - Cleanup" case.

0 Kudos
Message 1 of 5
(2,945 Views)
Solution
Accepted by topic author Gregory

It looks like the difference between the run-time and development environment behavior is the Front Panel Close event. If it's in Dev mode, you don't go to the Front Panel >> Close state, but you do in Run-time. Try running your Cleanup command before the Close command to see if that fixes it. If you close the Front Panel, the values might be getting reset, so the OpenG VI doesn't have any values to pull anymore because they've left the memory.

 

If the panel should be closed more rapidly, but you need to hide the Front panel without closing it, you could use the FP.Open invoke node with a State input of "Hidden". This will hide the front panel while keeping it open and then the panel will still close in the end when your application ends.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 5
(2,931 Views)

Thank you James, I really thought I tried that (as noted above), but I tried it again on the simple version I attached, and it appeared to fix the problem.

0 Kudos
Message 3 of 5
(2,925 Views)

Good to hear! Having a simple debug version of aspects of your code usually helps a lot.

 

See my edited comment above about hiding instead of closing.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 5
(2,920 Views)

I have had this problem also using the JKI State Machine. Somewhere on lavag.org, Rolfk explained that when a compiled exe closes it main window, the Windows OS stops everything about that program, that is, it is not allowed to do any background processes with a closed window. I usually close the main window after everything has finished. To do this, I put a close Window function outside of all of my JKI loops in the main program.

 

Cheers,

mcduff

Message 5 of 5
(2,907 Views)