LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find variable name for ini file

I have created an executable from my VI. When you run the executable it creates an INI file. From this INI file I am looking to set some defaults for some of the controls in the front panel. How do I figure out the key name to put in the INI file to be able to edit the default value of a control?

0 Kudos
Message 1 of 14
(3,965 Views)

Take a look at the INI manipulation vis. I am not sure if it is a good idea to use the default INI but I have never heard otherwise and have never tried it.

 

I am a little unclear on what you are asking. It sounds like you think that you can just set the default control values. You can not do that. You have to write initialization code to read the values from an INI and set the control values through a property node. So the key names can be anything you want them to be. You could use the control label value as the key which is readable through a property node.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 14
(3,960 Views)

I was just taking a guess that I could set the control defaults through the exe's ini file. What I want to do is be able to set default values for controls on the front panel. There are quite a few controls so I was trying to find an easy way around it. I have used the OpenG variantconfig VIs and those worked perfect but they arent compatiable with Labview 7 express. Whatever method I choose has to be compatible with LV 7 express.

0 Kudos
Message 3 of 14
(3,953 Views)

I basically need some way to do what the read/write to front panel VI's from the variantconfig package from Openg does.

0 Kudos
Message 4 of 14
(3,947 Views)

There is one value that I am wanting to save, the rest don't really matter. I want this value to show up right when you open the program, is this possible?

0 Kudos
Message 5 of 14
(3,933 Views)

Here is an example of using the INI VIs. I am assuming that the datatype is a string but change that if you need to.

 

Edit: I seem to have forgotten to wire the error out from open config to the case structure. But you get the idea.

 

ini.png

=====================
LabVIEW 2012


0 Kudos
Message 6 of 14
(3,919 Views)

Thanks for the example! I haven't had time to test it yet, but with that implementation is the default set when you click run or is it set when the executable is opened?

0 Kudos
Message 7 of 14
(3,909 Views)

I do not think you understand what the config file VIs do.  The ONLY thing they do is to read the config file.  They do NOT set anything.

 

If your front panel has a control named MyControl, then you would read the key "MyControl" from the config file.  After converting the datatype if necessary, you would then write the value from the file to MyControl via a local variable or a property node.  Your program must do all these steps to change a control value: Read the file. Convert the datatype. Write the value to the control.  LV does not do any of this automatically.

 

What Steve showed you was how to read the config file.

 

Lynn

0 Kudos
Message 8 of 14
(3,885 Views)

Your default value of your fp controls are whatever they were set to when they were created or what you set them to under Data Operations >> Make Current Value Default.  What I normally do is automatically save all the fp controls to the .ini or .cfg file upon exiting.  This ensures your last settings will be saved.  When the program starts up, it first reads the .cfg file and then updates the appropriate fp controls as needed (see attachment).  No need for propery nodes here.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 9 of 14
(3,880 Views)

Here is an example of a typical application. It has initialization code, a main loop and shutdown/cleanup code.

 

In the initialization code it reads the last value from the control. In the main application loop it writes each change to the control value to the configuration file. The shutdown code simply closes the configuration file.

 

The VI is also attached in LabVIEW 8.0 format.

 

ini.png

=====================
LabVIEW 2012


0 Kudos
Message 10 of 14
(3,871 Views)