LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

make current value fefault

hello,

i've got a problem with a global vaiable.

my application.exe reads values from an ini file.
to read the ini file i need a path.
this path is currently read from an global variable.

the problem is, that the application.exe can be installted on other pc's.
so the path of the ini- file (global variable) can change.

my idea is to create an vi wich checks if the ini-file exists.
if the file exists, the vi does nothing.
if the file doesn't exist, a message box would be opened and the user can choose another path where the ini-file is.
if the file doesn't exist, the used had to choose a path by every start of the application.
is it possible to set the last used path as default, or has anyone another idea to solve the problem.

my problem is not to check if the path exists. the problem is to set a default value of the global variable.

markus
0 Kudos
Message 1 of 3
(2,296 Views)
Hi,

I created an example for you. I hope this helps.
0 Kudos
Message 2 of 3
(2,288 Views)
I don't think a global's value can be made default at run-time. There are many problems with using global variables and this is often discussed (the most recent one yesterday).
However, not all is lost. If you have an ini file, I would expect it to be kept in a constant position relative to your VI or your data, so you should know where it is on your own, even without a variable, by using a relative path. If this isn't good and you HAVE to have it dynamic, you can always keep the path of the file in another file (a basic configuration file), which will have a constant path relative to your VI. Then, save the path of the ini file to the new file and read it from there when the program starts.
This would create a mess in your files, so I would think about your files should be structured before doing something like this. If you do decide to take the first method, you should be aware that when a VI is in an EXE, its path needs to be stripped an additional time, because the EXE acts like a directory. You can determine whether you're in an EXE by using the App.Kind property.

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