07-03-2024 11:28 AM - edited 07-03-2024 11:33 AM
Hi @d.w.b,
@d.w.b wrote:
wiebe@CARYA wrote:
So, you can try to get all VIs, classes, etc. by reference and use their path property to build a folder structure.
How to get references of unopened dynamically-called Always Included VIs?
I don't think it is possible to (easily) inspect the content of an executable.
What I usually do is build the path relatively from a static VI reference:
Physical folder in project:
This works because the executable keeps the same relative structure as the physical folders in your project.
Obviously, if you can drag & drop your "Always Included" VI in the static ref directly, it will be even simpler, because you will have the path directly and it will be included in the build automatically.
Regards,
Raphaël.
07-03-2024 02:18 PM
@hy12369 wrote:
I packaged an Application.exe on my D drive, which contains a folder 'Structrue',
and the output path when I run the program is: D:\builds\test\My Application\Application.exe\Structure.
Is there any way to list all the vi's contained in 'Structrue' folder?
Open the Build Spec for your Project. Click the Category called "Destination". You should see your Top Level VI listed as the first "Destination". When I build, there's a second destination, "Support Directory", which is listed as a folder under ...\LabVIEW Builds\Project Name, and which links to a folder called "data" as a Top-Level folder..
I'm not sure, but I don't remember "deliberately" creating such a folder, but I know how to "take advantage of it" to solve the problem you are asking about. The first thing I do is to create such a folder, "data", as a top-level folder in the Project. Without my doing anything else, this folder will appear in this same location in the "Builds" folder.
So one thing you can do is to put any files/folders you want to access inside the \data folder you just created in your Project (presumably in \My Documents\LabVIEW Data\My Project, which contains VIs, TypeDefs, and My Project.lvproj). How do you access them (i.e. "where is the folder")? Look in the File functions for File Constants, and look at "Application Directory". When you are running LabVIEW, Application Directory "points to" the folder containing your Project File, so the path to \data is Application Directory\data. When you are running the Build, Application Directory is changed to point to the folder containing your Build, so the path to \data is again Application Directory\data. Thank you, NI!
Now you have a reference to where you built your application, namely you know where \data is. If you have other folders that are created and "live with" the Application, you can find them by doing "relative path" operations. You can also (at build time) include additional folders that, like "data", can magically appear inside your Build. I frequently put a "Config" folder there (to keep Configuration stuff isolated from "data").
Bob Schor
07-04-2024 12:49 AM
@d.w.b wrote:
How to get references of unopened dynamically-called Always Included VIs?
If the VIs are unopened, they don't have references. You will need to open the references based on the path while the EXE is running.
You can include them in a separate LLB or directory as described before and list that.
If you want them to be included inside the EXE, you can configure the build to run a pre-build VI which lists the VIs and then takes their paths relative to a known VI and sets that as the default value of an indicator in a VI and saves that VI. In the EXE, you then call that VI to get the relative paths, add them to the path of the known VI (which can be called statically) and use that to open the references.