LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

context awareness

Solved!
Go to solution

how do I get to the path of the library project or application owning a call to a specific. Vi?


"Should be" isn't "Is" -Jay
0 Kudos
Message 1 of 9
(3,175 Views)

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.


___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(3,135 Views)

Hi, Jeff,

 

Do you want to know the paht of the project contained the SubVI?

Could I do it in the following way?

 

20141013001.JPG

Message 3 of 9
(3,128 Views)

Looking at the picture I actually realized two things -

 

  1. You want the path.
  2. 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:

Example_VI.png

 

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.


___________________
Try to take over the world!
Message 4 of 9
(3,113 Views)

@tst wrote:

Looking at the picture I actually realized two things -

 

  1. You want the path.
  2. 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:

Example_VI.png

 

 

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?


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(3,095 Views)
Solution
Accepted by topic author JÞB

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.


___________________
Try to take over the world!
Message 6 of 9
(3,084 Views)

Just to close the loop- 

Get Contex Project Path.png

Capture.PNG

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

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 9
(3,054 Views)

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.


___________________
Try to take over the world!
0 Kudos
Message 8 of 9
(3,046 Views)

@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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 9
(3,021 Views)