以编程方式卸载所有TestStand模块

更新 Nov 22, 2022

环境

软件

  • TestStand

我想以编程方式卸载所有TestStand模块,而不是通过手动点击菜单File-> Unload All Modules 。我怎样才能做到这一点?

对于TestStand 4.0和更高版本:
  • 在您的sequence中添加一个新的Statement步骤。
  • 将以下代码插入Expression文本框中:RunState.Engine.UnloadAllModules()。


对于TestStand 3.5和更早版本:
  • 选择ActiveX Adapter
  • 将新的Action步骤添加到sequence中。
  • 右键单击新步骤,然后选择Specify Module
  • 在Edit ActiveX/COM Adapter窗口中,将以下字段设置为相应的值:
  1. Object Reference: RunState.Engine.
  2. Automation Server: NI TestStand API <Your TestStand Version> (Ver 1.0).
  3. Object Class: Engine (IEngine).
  4. Action: Call Method.
  5. Method: UnloadAllModules.
  • 单击OK保存更改。

您也可以通过将Sequence Context发送到code module中并使用ActiveX功能来调用UnloadAllModules的方法。