ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Paths in Libraries when deployed

Solved!
Go to solution

I have a VI in a Library that looks like the following with two VIs

 

MyLibrary.lvlib\VIs\Private\Ref.vi

MyLibrary.lvlib\Main.vi

 

When I run the "Current VI Path" I get the following output:

 

In development Mode: C:\ni-rt\startupMyLibrary.lvlib\Ref.vi

When built to an EXE: c:\ni-rt\startup\startup.rtexe\Libraries\MyLibrary\VIs\Private\Ref.vi (This seems to be the Virtual Folder structure in the project)

 

What I want to be able to do is get a reference to Main.vi from Ref.vi that work in all instances.

 

I could put a property node ina nd get the app.kind value, but when happens if I added MyLibrary.lvlib\VIs\Public\Ref.vi to the library?

0 Kudos
Message 1 of 8
(4,952 Views)

Wire the reference into the Ref.vi? This is always the 'safe' option. Or create an FGV/Global which stores the reference of the Main.vi.

 

You can also use Static VI references but this sometimes falls over (e.g. reentrant VIs)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 8
(4,946 Views)

I don't have a reference to the Main.vi as I want to find out if it's running or not, which is why I need the file path of it.

0 Kudos
Message 3 of 8
(4,940 Views)

OK, Can you post some code? I don't understand what you're trying to do so - a Static VI reference to the Main.vi would give you the reference and you can then use the 'running' property on that providing it is non-reentrant (if I remember correctly)? 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 8
(4,926 Views)
Solution
Accepted by topic author Richard_Ha

Richard_Ha wrote:

I don't have a reference to the Main.vi as I want to find out if it's running or not, which is why I need the file path of it.


Sure you do -- it's called a Static VI Reference.  I use them all the time for non-reentrant VIs and never worry about whether I'm in Development or Execution mode.

 

Bob Schor

0 Kudos
Message 5 of 8
(4,922 Views)

I see what I'd done. When I tried this previously I'd Strictly Typres the reference and it didn't seem to work. When it's not strictly typed it does run.

0 Kudos
Message 6 of 8
(4,904 Views)

So the new problem is that to see if the VI is running, I need a Static Ref to the VI then check Exec.State=Idle

 

However if It's its not running I was to start it with an Asnyc Call, but this requires a Strict Reference and as soon as I place a strict reference down the VI is classed as running.

0 Kudos
Message 7 of 8
(4,876 Views)

This seems to work.

0 Kudos
Message 8 of 8
(4,870 Views)