10-12-2014 06:44 PM
how do I get to the path of the library project or application owning a call to a specific. Vi?
Solved! Go to Solution.
10-13-2014 01:01 AM
You seem to be mixing three different things here - library, project and application. I'm going to assume that by project you're referring to the app instance and not to the project window.
The VI class has an OwningApp property which I believe does what you want - it returns a reference to the app instance the VI reference was opened in. If you want the library, the class also has a Library property.
If that's not what you want, you might to actually explain in detail what you do want.
10-13-2014 01:19 AM
Hi, Jeff,
Do you want to know the paht of the project contained the SubVI?
Could I do it in the following way?
10-13-2014 03:05 AM
Looking at the picture I actually realized two things -
William, the problem with the method you used is that if there are multiple projects open, the first one may not be the one you want.
10-13-2014 04:52 AM
@tst wrote:
Looking at the picture I actually realized two things -
- You want the path.
- The OwningApp property actually appears to return a reference to LV itself (I'm assuming it's the main app instance) and there doesn't seem to be a direct way to get the current app instance, nor the project itself. If the VI is in a library then the library does return the reference of the project, which you can use. Likewise, the Application class does have a private Owning Project property which does appear to return a reference to the actual project the VI is in, but it's undocumented and I have no idea whether it's something you can rely on:
William, the problem with the method you used is that if there are multiple projects open, the first one may not be the one you want.
That would be what I was looking for. except Path would be preferable. Sometimes a path relative to the project helps when projects contain config files in them at a specific relative path. (I didn't set up the projects "Required structures")
What is the trick to unlock that OwningProject property?
10-13-2014 06:08 AM
Jeff·Þ·Bohrer wrote:...except Path would be preferable.
Then use the path property?
For private features, you might wish to read up on LAVA's scripting forum.
And the big thing is that if you're looking for paths relative to the project, then what you actually want is the Application Directory VI, which will return the folder of the project it's called in (or the folder of the EXE). Much simpler than going through the project itself.
10-13-2014 10:44 AM
Just to close the loop-
Does exactly what I need and tst's breadcrumb trail certainly got me pointed it the right direction to build this Documented reuse component.
The Attached zip is a test project and exe build to demo the behavior from an exe
10-13-2014 11:13 AM
What's the use case for getting the path of the project? I can understand wanting the project folder, but you already have that with a shipping VI (the app dir VI I mentioned earlier), so there would be no need to have a special VI for that.
10-13-2014 03:53 PM
@tst wrote:
What's the use case for getting the path of the project? I can understand wanting the project folder, but you already have that with a shipping VI (the app dir VI I mentioned earlier), so there would be no need to have a special VI for that.
Not any direct requirement. Just a "Nice to have" feature to work within a framework I did not architect. Basically, a nice drop-in that could have been done without.