LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to Application.ini

When i have built my application in Application Builder and run the Application.exe it creates a Application.ini.
Is it possible to access this file from any vi and read configurations from it used internally by my vi's in the Application?
0 Kudos
Message 1 of 7
(4,387 Views)
Sure, just open it and read/write whatever you want...

I often add some LabVIEW keys to it, if e.g. the executable is named hello.exe I add:

[hello]
HideRootWindow=True

This way the window of the application will not have two entries on the start bar.

You can use the configuration VIs to read and write keys to the file. The file will always have the same name as the executable.

If you add a section called MyConfig and save e.g. a logging frequency to the file in addition to the LabVIEW keys it will look like this:

[hello]
HideRootWindow=True
[MyConfig]
LogFrequency=10
0 Kudos
Message 2 of 7
(4,387 Views)
Well, what i ment was if there is an easy way to get that file name (as a path) or the the ini-file's refnum so i don't have to reopen it. I only need to read the file once.
0 Kudos
Message 3 of 7
(4,387 Views)
You can e.g. read the path of a VI included in the application and find the name of the application in that path...then remove the .exe part and add .ini...

I've attached a simple VI that does it, it's not as general as it could be, but should work OK.
0 Kudos
Message 4 of 7
(4,387 Views)
Here's a VI I made that will build the path to the apps ini file automatically, assumming the ini file is in the same directory as your application. Works in VIs, .llb and .exe.

If the ini file has the same name as the app, you don't even have to specify the name. Just drop it on the diagram of the VI and it outputs the refnum of the file for use with the other config file VIs.

This one is saved in 6.1, but it upgrades OK to 7 and 7.1


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 5 of 7
(4,387 Views)
Hey that looks really nice!
I'm running Labview 7.0 and when i load your vi I can't find 'Strip Path Extension_ogtk.vi' and 'Strip Path X times.vi', where can i find them?
0 Kudos
Message 6 of 7
(4,387 Views)
Sorry about that, I forgot there were non NI subvis in there.

Here they are. The Strip Path Extension is a polymorphic VI so you'll need to unzip all the zipped files to use it.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Download All
0 Kudos
Message 7 of 7
(4,387 Views)