LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store Current Settings Between Standalone .exe Executions - how to? best practices?

All,

 

Possibly I am not using the proper key words but i am having no luck here on the forums finding an answer to the following problem.  I need to store the current settings of a running compiled stand alone program.  The vi was made in windows and compiled in windows labview if that matters.  As the VI is running I need to store the current state of switches, current variable related to any input a user can make such as text or numbers, etc, I want to store this every few seconds to capture the last state that the VI was running at.  It is not necessary to store any of the data read from sensors etc.

 

The reason i need to do this is to allow the user the option to reload the previous shut down condition of the stand alone program when it is next executed.  Thus if the user wants, he or she can simply pick up where they left off with the settings they had input.

 

How is this done?  I am finding nothing using the key words I can think of.

 

Second what is the best practice here?  I would like to store the data on a timed basis during the vi execution, thus if the computer locks up, vi crashes, or windows crashes, etc.. the user still has a point close to the the last data to restart from.

 

Any help here or pointers to the proper thread?

 

Thanks

 

Tester0070

0 Kudos
Message 1 of 6
(2,539 Views)

Hi tester,

 

you will have to program some routines to store your current settings into files on your harddisk. This has been discussed often before, most recommend using INI files for easy reading/editing with text editors...

 

I would use a functional global variable (FGV) to store current UI settings. In the FGV I would include the file saving routine (maybe called whenever an UI setting is changed) and the loading routine, called at the start of your main VI...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,538 Views)

If you're talking purely about UI values, then I would suggest something like this - https://decibel.ni.com/content/docs/DOC-15349

In your case, you can call the save VI on all value change events (the easiest would probably be to take the array of control reference and wire it into a Register For Events node. That way you can register for all of them and handle them in a single case).


___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(2,531 Views)

Proven Zealot

 

This solution looks like that one that could work for me.  I think I could simplifiy it a bit tell me what you think.

 

As for the read, I will call that once on one of the first execution counts of my main while loop.  I will pop a dialog asking the user if they want to load previous values, if they answer yes, I will load, else forget it and move on, never to run again.

 

As for the write, I will write out all of my needs every 15 seconds or so, I will forget the other states as I really do not need to catch any of that.  I will simply use the write vi to accomplish that in a timed loop.

 

My only fear is to create the reference node, I have so many things on quite a few tabs I need to grab... not looking forward to that task.

 

Thanks for the input, I will let you know how it goes.

 

tester0070

0 Kudos
Message 4 of 6
(2,523 Views)

What you need for these VIs to work is an array of control references. One way to create it is to build it explicitly, as shown in the example, but you could also use the different Controls[] properties (e.g. for the panel or for each page in the tab control) to get the array directly and I have done this too in the past in cases where I had more than a few controls. One thing to keep in mind in that case is that if there are controls you don't want to save/load, you need to search for their reference in that array and then delete it.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(2,510 Views)

I have implemented the example provided in a basic way.  It seems to be working, but I will not be able to test until I have actual hardware to use with a compiled version.

 

This all said, it seems the only issue is just as you point out.... selecting what you want to store and what you want to go to a default.

 

I should be able to update how this goes by Thursday.

 

Cheers

0 Kudos
Message 6 of 6
(2,507 Views)