LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save buttons and textboxes to file

I have a large program with many tabs and buttons and textboxes/arrays. Currently I read and write to an Excel file. It seems to me that if I can save everything as default, I should also be able to save to different files. This would save a lot of code and be more scalable, I think.

0 Kudos
Message 1 of 9
(1,986 Views)

Your explanation is vague and does not clearly explain what your ask is.

 

Please rephrase your query and provide all supporting details.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 9
(1,967 Views)
I just want to be able to save everything that gets saved when you select Edit/ Make current values Default to different files.
0 Kudos
Message 3 of 9
(1,959 Views)

So, you would like to read the last values of the controls in your VI to a file when the execution ends.

 

Now, instead of writing all control values to the same file, you want to write the values to different files based on the tab that control resides in - is that correct?

 

I believe there is no existing easy way that LV provides for you to do that, of course, you can implement it the way you like to store a different set of control values to different files.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 9
(1,952 Views)

There is a shipping example that statically saves your front panel objects' value to file. Study it and you can probably figure out how to modify it to select the file for saving and restoring.

 

How to Save, Overwrite, and Read Front Panel Objects' Default Value to a File

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 9
(1,938 Views)

So, you would like to read the last values of the controls in your VI to a file when the execution ends.

YES

 

Now, instead of writing all control values to the same file, you want to write the values to different files based on the tab that control resides in - is that correct?

NO

 

I want to save the current condition of the front panel and give it a filename. Just like under the Edit menu  "Make current values default but have a folder with different default values to choose from.

 

I currently save all these things individually and the save function is bloated with arrays and textboxes/dropdowns, and it's difficult to expand it because if I add something I have to change my spreadsheet that I read and write the values to. I have to add the new controls to the read and write section and it's just painful.

 

0 Kudos
Message 6 of 9
(1,903 Views)

@RHutchings wrote:

So, you would like to read the last values of the controls in your VI to a file when the execution ends.

YES

 

I want to save the current condition of the front panel and give it a filename. Just like under the Edit menu  "Make current values default but have a folder with different default values to choose from.

 

I currently save all these things individually and the save function is bloated with arrays and textboxes/dropdowns, and it's difficult to expand it because if I add something I have to change my spreadsheet that I read and write the values to. I have to add the new controls to the read and write section and it's just painful.


If you do NOT need to use an Excel sheet then the following may work for you with minimal coding:

  1. Use VIPM to install MGI Read/Write Anything
  2. Make sure all your controls have unique labels. Use captions if labels need to be identical.
  3. The following below will save text file of all of the controls and their values, excluding the tab values, but that can be added in. Also I assumed all the controls are in the tabs, once again modify to add other controls.

Snap37.pngSnap38.png

 

0 Kudos
Message 7 of 9
(1,885 Views)

Another even easier option.

 

Download OpenG Tools from VIPM.

 

There is a Write Panel to INI tool that will write all the values of the front panel to an INI file.  See below.

 

Snap39.png

 

The file contents look like this

[Untitled 3]
Tab Control = "Page 1"
Array = "<size(s)=3> 1.000000 2.000000 3.000000"
String = "My Value"
Numeric = "2.000000"
Boolean = "FALSE"
Path (dialog) = "/C/Users/XXXX/TestRWAnythinTab.txt"
configuration file path = "/C/Users/XXXX/TestRWAnythinTab.ini"
0 Kudos
Message 8 of 9
(1,882 Views)

Thank you all. I'll give these a try after the holiday on Monday.

0 Kudos
Message 9 of 9
(1,866 Views)