From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

removing search directory by name dynamically

I have been using the SearchDirectories.Insert method to add search directories in TestStand dynamically.
 
Now I am required to remove a search directory dynamically. The problem is that the SearchDirectories.Remove method lets me specify which directory to remove by inputting the index in the list instead of the name/path of the search directory. This is a problem because I will not know at which position is the directory I want to remove in the list.
 
Any suggestions??
 
Thanks
 
Anuj
0 Kudos
Message 1 of 6
(3,406 Views)

Hi,

You could try looping thru all the search directories and comparing the name of the search directory with the one you want to remove. When you get a match use the index value of your loop in the SearchDirectories.Remove method.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 6
(3,400 Views)
Ray,
 
Thanks for your reply. I did not think about this. I started implementing your solution by first retrieving the number of directories using the Count property of SearchDirectories, then calling the Item property for each index, then accessing the Path property for each item. I somehow don't see the path getting returned and I can't figure out why.
 
I have isolated that code into this VI. Can you look at this and tell me what I am doing wrong?
 
Thanks
 
Anuj
0 Kudos
Message 3 of 6
(3,392 Views)
Howdy anuj,

The
SearchDirectory.Path propery will return empty strings based off the the SearchDirectory.Type property. For more detailed information, refer to the TestStand Help (Help >> TestStand Help; search for "SearchDirectory" in the Index tab; Then read the remarks section for the Path property).

Best Regards,

Message Edited by Jonathan N on 09-29-2006 11:25 AM

Jonathan N.
National Instruments
0 Kudos
Message 4 of 6
(3,387 Views)
Hi,
 
Jonathan has a point.
Some of the Paths returned will be empty depending on the Item (index). Such as the CurrentSequenceFile Director, if the SequenceFile has been saved then the SearchDirectories.Path will be empty.
 
You probably are not going to remove any of the TestStand search paths, ie the first 13 items, so you will have to check the Type first and if it returns SearchDirectorType_ExplicitDir, then you can check the Path and decide if its a match.
 
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 5 of 6
(3,369 Views)

Yes, I realized this. Unfortunately all the indicies that I happened to test that day were the ones that would return an empty string.

I understand the type concept now and it makes sense and I got my thing to work.

Thanks !!

Anuj

0 Kudos
Message 6 of 6
(3,353 Views)