Jump to content

Opening the containing lvproj of a VI reference


Pulp

Recommended Posts

Hello all,

 

I'm trying to create a VI Analyzer test that verifies certain properties of the containing lvproj of a VI reference. post-33616-0-17794300-1366198946_thumb.p

For quite some time I thought I was doing well, until I noticed the lvproj I was verifying was already in memory. And when it isn't, OwningApp can't provide its reference. Is there a way to open the lvproj programmatically? Or another way to obtain the lvproj reference?

 

Thanks in advance & greetings,

Bart

 

 

Link to comment

Well a VI does not know if it belongs to a project (it might even belong to several projects, which is bad), so I guess the best you can do is the following:

ZWhkmqa.png

This will look in the folder of the VI for a project file, if one match is found that is returned, otherwise it will look to the folder above the VI project, untill the root of the filesystem is found.

If more than one file is found you need an algorithm to find the best match. One option would be the Levenshtein distance

 

Ton

Link to comment

A library *owns* a VI. A VI *is owned* by a library. The two have an indelible link. A VI may be owned by one and only one library.

 

A project merely uses a VI or library. The same VI or library may appear in many projects. A VI is only part of a project when the project is in memory. Any other time, there is no "owning" project.

Link to comment
A library *owns* a VI. A VI *is owned* by a library. The two have an indelible link. A VI may be owned by one and only one library.

 

A project merely uses a VI or library. The same VI or library may appear in many projects. A VI is only part of a project when the project is in memory. Any other time, there is no "owning" project.

I noticed today that there is a private method "Owning Project" and it works the way AQ mentioned where it would not work if the project owning it was not open.  As an experiment I added this VI to two projects and opened them at the same time.  The property worked as expected where the VI running in the context of one project would return a reference to that, and if it was running in the second projects context it would return that reference.  This property does differ slightly from the "Active Project" property which is a scripting method but not private.

 

NI does not support private methods and it's functionality may change unexpectedly so use with caution, or don't use it at all.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.