Finding LabVIEW Version of a File

Since I do consulting, I often end up inheriting code.  Often I get called in because someone had hired a LabVIEW developer to write some code for them and then the LabVIEW developer had disappeared, either retired or moved, or got another job or something similar.  Luckily they usually leave the source code.  So I’m sent this zip file full of vis (hopefully it’s not just “the VI”).   And the person who sends it to me knows nothing about LabVIEW and has no idea what version it was written in.

Now I could always just open it in the latest version of LabVIEW. The problem is that often times this code works as is (they just want to fix a bug or two or add some small feature).  And it’s usually already installed on some hardware somewhere with a bunch of drivers.  The latest version of LabVIEW may not be compatible with those drivers, but I know that whatever version it was originally written in does work with those drivers.

So how to figure out what version of LabVIEW?  Well, I have written a tool called AVM for managing multiple version of LabVIEW on the same computer.  I could certainly use that and if I had the correct version of LabVIEW installed on my computer, it would automatically open it in the correct version and if I didn’t have the correct version, it would let me know.  That is certainly one solution.

However, lately, I have migrated away from having multiple versions of LabVIEW on the same computer.  I now create a separate virtual machine (VM) for each project with the correct version of LabVIEW with all the drivers and any other associated software that is needed.  See my series on Virtual Machines.  I start with a VM that already has LabVIEW installed on it and clone it and start adding drivers as needed. I have a different VM with each version of LabVIEW. So I need to know which one to start with.

AVM was overkill for what I needed so I wrote a quick and dirty little utility.  It’s an exe that I leave on my desktop.  I can simply take any LabVIEW file: vi, lvlib, lvclass, lvproj, etc. and I simply drag onto the utility and throws a popup that tells me what version of LabVIEW it was written in.  The exe was written in LabVIEW. It is very simple.

Here are some screenshots of it in action:

The trick is to read in the command line arguments.  When you drag a file or files onto an exe in Windows it passes all their paths as command line arguments.  Then you simply read them in LabVIEW using an application property node. Remember to remove the first element as that is the path of the exe itself.  You also need to remember to pass command lines in the build spec.

Here is the important build spec setting.

Here is a screenshot of the main block diagram.  I apologize if the block diagrams don’t meet your style standards.  Since it was quick and dirty, I just hit block diagram cleanup.  They are simple enough that you should be able to figure it out even though some wires cross.

Then there are property nodes that will return the LabVIEW version for a project, vi (including vit, vim, .ctl etc), or library (.lvlib or .lvproj etc).  So I just cycle through those and check the errors as seen below.  And then throw a simple popup.

Here is the code for finding the version.

Source code here. Enjoy.

Want more Custom Tools?