01-18-2011 12:45 PM
I have some files that will be zipped. These should always be inclued with the VI (exe or whatever). I dont want them as external files... I would like them embedded inside of the VI.
Is this possible?
Thanks!
01-18-2011 01:43 PM
No. At least not directly. You can, instead, use packet project libraries, a feature of LabVIEW 2010.
You can also handle that situation with an installer that will be sure to install the files at the same time as the VI.
01-18-2011 04:37 PM
With scripting, you can use tags to put any data (including files) inside virtually LabVIEW object.
Use an invoke node, with the methods Tag.GetTag and Tag.Set Tag.
01-18-2011 05:40 PM
Thanks.
However, I have LV 2009 and I cant open your example. Any chance you can save it for my version?
01-18-2011 07:10 PM
You can't really embed files within a vi. You can embed VIs within some file formats (exe, lvlibp, llb), but not miscellaneous files. If your file needs to only be accessed through LabVIEW then instead of storing the data in a file you can store it in the VI via default values, constants, or data tags.
If you explain why you don't want the files separate from the vi we might have some better suggestions. For example if it's for ease of installing you could either make an installer or put code and data into a single zip file for the user to extract. To avoid any changes to the external files, you could embed the data in the VI, store a hash of the file in the VI, or data obfuscation. None of these could stop someone skilled who really wants to mess with it though. To limit changes to external files to authorized users then you could use data obfuscation.
01-18-2011 07:22 PM
You could take the file, and load it 'binary' into an indicator. Change this to a constant. Now you need to restore it during runtime by writing the data to a newly generated file.
Felix
01-19-2011 10:40 AM
Here it is.
Note: It's not a program just a set of invoke nodes that you can use to store/retrieve/erase data
01-19-2011 12:40 PM - edited 01-19-2011 12:41 PM
I agree with Felix that yes you can stuff a file into a VI.
In the Obfuse Code thread post # 40 I posted an entry (that will not work since it is too old) that has a sub-VI stuffed into the diagram as a constant. THe example code write the file to disk and saves it as a VI then runs that VI to do the required work and at the end deletes the sub-VI.
So yes you can stuff a file into a VI.
Ben
01-19-2011 01:05 PM - edited 01-19-2011 01:06 PM
Thanks for the replies guys.
Very helpful!