NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Inserting search directory

Solved!
Go to solution

Hi Ppl,

 

I tried programmatically inserting a search directory. I used the method Engine.SearchDirectory.Insert. After calling this method I called the SearchDirectory.Reload method. Despite calling this method the newly added directory was not displayed in the search directories list in sequence editor. When we change Mytypes.ini or other configurations external to sequence editor I get the pop up to reload them. But when I inserted search directory It didnt ask for reloading. I had to restart sequence editor for the new directory to be listed. How do I reload without restarting sequence editor ?

 

Below is the code that I used .

 

psot.jpg 

0 Kudos
Message 1 of 9
(6,621 Views)

Hi Lordsathish,

 

Have you ever tried to call Engine.UnloadAllModules after SearchDirectory.Insert ?

 

Hope this helps,

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 9
(6,618 Views)

Hi Juergen,

 

I tried it. But still the directory is not listed without restarting sequence editor.

 

Thanks 

  

0 Kudos
Message 3 of 9
(6,616 Views)

Hi

 

Sounds bad and according to this old thread

it sounds worse.

http://forums.ni.com/ni/board/message?board.id=330&message.id=807&query.id=1116352#M807 

 

"Note: The changes that you make to the config file will not take effect until you restart the Sequence Editor. This is due to the fact that we cache the config file when the Sequence Editor is loaded.
"

 

Maybe the "blue ones" have some workarounds i am courious on the answer

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 9
(6,612 Views)

Juergen,

 

Do you think there is any work around ?

 

Thanks 

0 Kudos
Message 5 of 9
(6,607 Views)

Sathish -

 

Are you calling this VI from TestStand or stand-alone in the LabVIEW environment? I tested out the same API and was able to get it working using the TestStand Expression language. What version of TestStand are you using?

Manooch H.
National Instruments
0 Kudos
Message 6 of 9
(6,585 Views)

Manooch,

 

I'm using TestStand 4.2. I tried calling this VI from LabVIEW. It was not from TestStand. I created the automation reference of TestStand Engine and used it in the VI.

 

Thanks

0 Kudos
Message 7 of 9
(6,574 Views)
Solution
Accepted by topic author lordsathish

Sathish -

 

I believe the behavior you are seeing is expected. When you call the VI stand-alone outside of TestStand, you are creating a different instance of the engine. Thus, you have one instance of the TestStand Engine in the Sequence Editor process, and one instance of the TestStand Engine in the LabVIEW process.

 

Now, when you call SearchDirectories.Reload() from the LabVIEW VI, you are telling the LabVIEW instance of the TestStand Engine to reload the SearchDirectories that it has cached from the SearchDirectories on disk, however, this has no effect on the Sequence Editor instance of the TestStand Engine.

 

Now, if you were to call your VI as a code module from a sequence that you execute within the Sequence Editor, and you pass the Engine as an input to the VI (RunState.Engine), then you would see the behavior you are expecting.

 

You could also try the following as a test: With the Sequence Editor open, run your VI as you have been. Then, in the Sequence Editor, execute a step that calls RunState.Engine.SearchDirectories.Reload() (if you're in TestStand 4.0 or newer, you can simply call this in a Statement step). Then check the Search Directories... have they updated?

 

Hope this helps.

Manooch H.
National Instruments
Message 8 of 9
(6,566 Views)

Manooch,

 

I will have to call this VI from a operator interface. So I will use ApplicationManager.GetEngine. So far I was only trying to check if this will work. When I call this VI from the operator interface I think this should work.

 

Thanks 

0 Kudos
Message 9 of 9
(6,557 Views)