LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a vi find out it's own file name?

Solved!
Go to solution

I have an inspection program that write results to a text format logfile on every cycle. In that logfile I want to add the name of the inspection program. I realize I could do this with text on the block diagram, but every time I update the program and save it with a different name I will have to remember to change the text.

So, if my vi is called Resultfile1-0.vi I want to append that to the log file. If I then create a new version of the program and call it Resultfile2-0.vi I want it to write that to the logfile.

 

Any suggestions?

0 Kudos
Message 1 of 6
(3,294 Views)
0 Kudos
Message 2 of 6
(3,288 Views)
Solution
Accepted by topic author another_novice

It call "Current VI's Path" in the File Contant palette

Omar
0 Kudos
Message 3 of 6
(3,283 Views)
Solution
Accepted by RavensFan

VI_Name.png

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(3,277 Views)

Give credit to Omar.  That is an even simpler iimplementation.

 

 

Either his or mine will give the full path if that is what you want.  If you want just the file name, then use Ben's, or you would need to use Omar's or mine and use a Strip Path function after it to get just the filename.  (and perhaps a path to string to convert it to a string.)

0 Kudos
Message 5 of 6
(3,276 Views)

Thank you everyone. I was sure it would be simple, for someone who knows their way around the pallets.

0 Kudos
Message 6 of 6
(3,253 Views)