10-07-2015 07:32 AM
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?
Solved! Go to Solution.
10-07-2015 07:40 AM - edited 10-07-2015 07:41 AM
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)
10-07-2015 07:42 AM
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.
10-07-2015 07:51 AM
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)?
10-07-2015 07:52 AM
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
10-07-2015 08:08 AM
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.
10-07-2015 10:33 AM
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.
10-07-2015 10:39 AM
This seems to work.