From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vi search path

Hello all,

I have a problem with "vi search path" in Labview.

--------------------
First, here are information about our directories architecture to understand the problem.

We are using the following architecture for our developments:

Each project is located in a specific directory.
ex: Project 1 is located in D:\Data\PRJ1
Project 2 is located in D:\Data\PRJ2

In the project directory, there is a subdirectory called "TestTools".
All Labview developments for a given project are located in this directory
and its subdirectories.
ex: D:\Data\PRJ1\TestTools

In the TestTools directory, there are subdirectories:
--> ...\TestTools\Tests : containing test VIs (top level)
ex: D:\Data\PRJ1\TestTools\Tests\Test1.vi
D:\Data\PRJ2\TestTools\Tests\Test45.vi

--> ...\TestTools\Utils : containing sub-vi for the tests.
ex: D:\Data\PRJ1\TestTools\Utils\HF\HF_cfg.vi
D:\Data\PRJ2\TestTools\Utils\CAN\CAN_start.vi

--------------------

If I add "[topvi]/*" in the "vi search path" menu, Labview will search
the sub-VIs for my application in the directory of the toplevel VI (and its sub-directories).
ex: if I open "D:\Data\PRJ1\TestTools\Tests\Test1.vi", Labview will search the sub-VIs
in the following directory: "D:\Data\PRJ1\TestTools\Tests".
Labview will not be able to find the sub-VI called "HF_cfg.vi" which is
located in "D:\Data\PRJ1\TestTools\Utils".

--------------------

I can add "D:\Data\PRJ1\*" in the "vi search path" menu but It will work only for Project 1,
and it will not work for Project 2.

I must replace it by "D:\Data\PRJ2\*" to work with Project 2.
If I don't do that, Labview will not find sub-VIs for the tests of Project 2.
(or it will find wrong sub-VIs located in the directory of Project 1 !!)

This is a problem because we often switch from one project to another.
We close and re-open Labview when we switch from one project to the other to be sure
that Labview is not using VIs already loaded in memory, but we still have problems
with "VI search path".

--------------------

Is there a way to configure Labview to search sub-VIs from an upper directory
that the topvi directory?
Something like that: "[Topvi]\..\*"
(the parent directory of the topvi directory, and all its sub-directories).

I tried "[Topvi]\..\*" but Labview does not support this type of directory.

Someone suggested me to use "Source code control".
I am using Labview Full Dev (not Labview Professional) so I can't use "Source Code Control".
Is there another solution for my problem?

Thanks for your support.

NLu
0 Kudos
Message 1 of 4
(3,705 Views)
The search paths are stored in the LabVIEW.ini file, so what you can do is have to ini files named PRJ1.ini and PRJ2.ini which have the correct search paths for them within the ini.

I would then suggest using a short cut for each project that points to a batch file or 2. In that batch file you copy and rename the PRJ1 ini to be LabVIEW.ini and then launches LabVIEW. So when you click on the PRJ1 shortcut it sets the correct ini for you and launches LabVIEW for you. You then shutdown labview and select the PRJ2 shortcut which inturn replaces the LabVIEW.ini with the one it wants, and launches correctly.
Message 2 of 4
(3,678 Views)
Dear NLU,

the behaviour is somehow strange. I have projects with some similar folder layout in which sub-VIs are located under ..\..\DMS\sub.vi relative path from the toplevel VI. The search path is set to default. These VIs are really sub VIs not dynamically loaded. The toplevel VI holds the relative path to its sub VIs if they are on the the same drive and the absolut path if the drive is different. This is a least true from LV 3.0.1 to LV 7.1 under all Windows OS I have used (95 and ME I haven't used).

Unloading LabVIEW when changing the project is absolutly neccessary since LV holds a list of all folders where it have found VIs during a session. If you switch from PROJ1 to PROJ2 LV will load VIs with the same name in PROJ1 and PROJ2 but with different paths from the path used during working with PROJ1. Unfotunatly there is no menu entry for "Empty VI found list".

The solution provided by Evan can be made simplier. Create a shortcut to LabVIEW and use the command line parameter -pref to load the desired preference file. Look in the help under "LabVIEW-Defined Command-Line Arguments" for the exact usage.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 3 of 4
(3,672 Views)
Thank you all,

I have built my own solution with your informations.
I have made a batch script that dynamically creates the configuration file (labview.ini), using the path of the .vi file I want to open.
I modified Windows Registry to associate .vi files with my batch script (instead of Labview).

When I want to open Labview:
1) my batch script is called and creates the right configuration file, with the right search path (relative to the .vi path).
2) The script launches Labview and opens the .vi file.

I must open .vi files by double-clicking on the file.
I must close Labview before opening a new .vi file.

This is not an ideal solution but it works.
Message 4 of 4
(3,604 Views)