NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX TestStand python - set environment (.tsenv)

Solved!
Go to solution

Hi guys,

 

I found how to execute sequence from python via ActiveX object.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LpMSAU&l=cs-SK

 

But I would also like to set environment.

Something like /env argument for command line:

https://zone.ni.com/reference/en-XX/help/370052W-01/tsfundamentals/infotopics/startup_opt/

 

How can I achieve this?

0 Kudos
Message 1 of 4
(3,805 Views)

Here's an older thread about this that might be useful

https://forums.ni.com/t5/NI-TestStand/How-to-specify-environment-when-using-custom-interface/td-p/36...

 

It should be a similar process to do the same thing with Python

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 2 of 4
(3,771 Views)

thanks a lot 😀

Now I knew how it works,

but not have a clue how to call this COM object from DLL in python.

0 Kudos
Message 3 of 4
(3,738 Views)
Solution
Accepted by mirrko

I was able to get it to work by using the CLSID:

 

import win32com.client
tsEngineInitSettings = win32com.client.Dispatch("{DEF1D36A-327A-487D-876D-816D0D171888}")
tsEngineInitSettings.SetEnvironmentPath("C:\\Users\\Demo\\Desktop\\myEnv.tsenv")
tsEngine =  win32com.client.Dispatch("TestStand.Engine")
print(tsEngine.GetEnvironmentPath())

 

 

https://www.linkedin.com/in/trentweaver
Message 4 of 4
(3,718 Views)