LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I retain file save path as the default save path the next time my vi is run?

Solved!
Go to solution

Hello all,

 

Forgive me if I use incorrect terminology here but what I would like to do is this:

 

In my vi I require that the user enters a path and file name for saving a file. I would like to somehow make this the default value in the file path save box the next time this program is run (the computer may be turned off between runs).

 

I've done some searching online but to no avail-it may be that I'm not describing the problem correctly. Does anyone have any suggestions on how I might go about doing this? It seems that it should be something quite simple but it has me vexed.

 

Cheers,

Alex

Alexander H. | Software Developer | CLAD

0 Kudos
Message 1 of 6
(8,384 Views)

Configuration file.  There is a good example:

 

C:\Program Files\National Instruments\LabVIEW 8.6\examples\file\config.llb\Write Configuration Settings File.vi

 

Jean-Marc

Message 2 of 6
(8,376 Views)
Write the path to an .ini file (or similar) whenever it changes. Later read it at program start, and write it to the path control via a local variable.
Message 3 of 6
(8,373 Views)

I've considered using a config file but here is the added problem I didn't want confuse the issue with: the file that I mentioned in the orginal post is actually itself, a config file. I need to allow different users to save it where they need to and have the program remember where the last one saved was. This isn't how I would personally create this program but convincing the powers that be to do it the other way is not an option.

 

I suppose I could make an inital startup config file to save where the last user's config file is.... I was wondering if there was a way to internally save this value-perhaps as a global variable or default.

 

Any thoughts?

Alexander H. | Software Developer | CLAD

0 Kudos
Message 4 of 6
(8,365 Views)
A LabVIEW executable cannot modify itself, which is essentially what you are asking to do. Therefore, this information must be saved external to the application.
Message 5 of 6
(8,354 Views)
Solution
Accepted by topic author alexhunt

You can for example save it in the system temporary folder (there's a path constant for that!) or next to the executable. If it should be different for each user, place the ini file in the default folder or default data folder.

 

If you have LabVIEW 2009, you have a few more predefined locations: Have a look at get_system_directory. Simply put the ini relative to one of those locations and it will know how to find it later.

Message 6 of 6
(8,345 Views)