NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I determine if TestStand is running from CVI?

Solved!
Go to solution

I am programming a popup for my custom operator interface. I need to put this popup in the process model. The problem is I don't want it to popup in TestStand. Unfortunately they must share the same process model. Does anyone know how to determine whether you are running from TestStand programmatically through CVI. I just want my code to know whether it is being used for TestStand or CVI. If CVI, then it can use the popup, if TestStand then I would like for it to popup nothing.

 

If it is possible to do this I would also like to see what sequence file it is running in TestStand and get the current directory of that particular file. All this I need to do from LabWindows/CVI 7.1 and I am using TestStand 3.1.

 

Thanks to anyone who can help me on this one. :smileyhappy:

0 Kudos
Message 1 of 4
(4,115 Views)

Hi InquiringMind,

 

One property comes to mind, Engine.ApplicationLicense. This property returns a numeric value which specifies what type of license the application is using or requires. When in the Sequence Editor, this property will return a value of 300. When in a Full Featured UI it will return 200. When in a Simple OI, it will return 100.

A_Ryan
AES
National Instruments
Message 2 of 4
(4,095 Views)
Solution
Accepted by InquiringMind

Or the property Engine.ApplicationIsEditor

Message Edited by paulmw on 01-19-2010 01:44 PM
Message 3 of 4
(4,078 Views)

The Engine.ApplicationIsEditor property may not be full-proof. This property returns true if your application/UI is specified as an editor. The TestStand Sequence Editor is an editor so the Engine.ApplicationIsEditor property will certainly return True. However, any UI can also be specified as an editor by setting Engine.ApplicationIsEditor = True in the code for the UI. For example, the TestStand Full-Featured UIs are specified as editors (when run in Editor mode) and so the Engine.ApplicationIsEditor property will return True for these as well if they are being used in the Editor mode (it will return False if they are being used in the Operator mode).

 

Aaron's suggestion to use Engine.ApplicationLicense is probably the best way to know whether or not you are in the Sequence Editor. Engine.ApplicationLicense will return 300 if and only if you are in the Sequence Editor. It may or may not return 200 for a Full-Featured UI or 100 for a Simple OI, but if the only thing you are trying to distinguish is whether or not you are in the Sequence Editor, then you just need to check if it returns 300 or not.

 

As for your second question, from inside the process model (while executing), you can get the path of your client sequence file using the RunState.ProcessModelClient.Path property. You can then use the following code to get the directory path:

 

Directory Path =  Left(RunState.ProcessModelClient.Path, Find(RunState.ProcessModelClient.Path, "\\", 0, True, True))

 

Hope this helps.

 

 

Manooch H.
National Instruments
Message 4 of 4
(4,062 Views)