08-08-2017 08:29 AM
Hi,
I'd like to create a Log file. I know how to do it by including the path of the log file "c:/......" it works on my pc. However, my programm will run on a machine which has no C directory. I could make it work by putting it on a usb key and plug the key on the machine but that's not the idea.
So i would like to know how to add the file in project (or in dependencies maybe) to make the screen work. Actually i get the error "LabVIEW: The path is empty or relative. You must use an absolute path."
Thanks in advance
Solved! Go to Solution.
08-08-2017 08:36 AM
Hi ghamm,
you could open a dialog to let the user choose a path.
Or you could read a known folder path using the GetSystemDirectory function (like "user documents" or "public documents")!
Just using a filename without any file path will never work…
08-08-2017 08:39 AM
Good suggestions from Gerd. The File Dialog express VI is surprisingly useful if you want to pop up a dialog.
Another approach is to use the "Application Directory" function, which returns a path to where your project is stored (where your executable is stored in a built exe). You can then build a path using that.
08-08-2017 08:58 AM - edited 08-08-2017 08:59 AM
Thanks for your answer,
I can't use the dialog box, my programm open it at each loop of my for.
I open the file in my controller.vi to add logs then i close the file and i reopen it in my View.vi to display what has been saved.
I'll try the second option on the machine as soon as possible
08-08-2017 09:07 AM
Hi ghamm,
I can't use the dialog box, my programm open it at each loop of my for.
Nobody said you should ask for a folder inside a loop!
Usually you only ask once before the loop. And even better: usually you also store settings in additional files so the user does not have to choose the very same folder with each start of your VI…
I open the file in my controller.vi to add logs then i close the file and i reopen it in my View.vi to display what has been saved.
So you write to the log file in one place of your program and you read from the very same file in a different location in your program? Does this sound like a "good" option?
08-09-2017 01:54 AM
You're telling me to store settings in additionnal files when i said that i couldn't use files because i can't find them from the machine..
And how it should work ? One vi to display all the logs from the launch of the machine, 1 vi to add the newest actions.
08-09-2017 02:01 AM
Hi ghamm,
You're telling me to store settings in additionnal files when i said that i couldn't use files because i can't find them from the machine..
Why can't you use files?
In your first post you said you want to create file so I guess you CAN use files!?
08-09-2017 03:08 AM
I can create and use file only if they are link to the project, i can't have a path like "C:...." The machine is really basic, it can't get something on the server
08-09-2017 03:10 AM
Application Directory is not in my function list
08-09-2017 03:13 AM - edited 08-09-2017 03:14 AM
Hi ghamm,
Application Directory is not in my function list
Check the file path constants…
i can't have a path like "C:...." The machine is really basic, it can't get something on the server
Does your "machine" have any local storage?
Then you can/should use it - all you need is to determine the correct path!