From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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,322 Views)
0 Kudos
Message 2 of 6
(3,316 Views)
Solution
Accepted by another_novice

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

Omar
0 Kudos
Message 3 of 6
(3,311 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,305 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,304 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,281 Views)