Example Code

Interacting with the TestStand Sequence Editor Using Built In UI Messages

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Description

Overview

This example shows how you can use specific built in UI message codes to instruct the sequence editor 

  • Cascade or Tile Execution or Sequence File Tabs
  • Display the report for a specific execution tab
  • Close and Open sequence file or execution tabs

 

Description

If you are not familiar with TestStand UI messages, read the following tutorial before using this example:

 

Tutorial: Using TestStand User Interface Messages (UI Messages)

 

In this example, built in UI message codes are used with the Thread.PostUIMessage method to send commands to the sequence editor.  With these UI message codes, you use the ActiveX parameter to specify which executions and/or sequence files the command applies to.

 

RunState.Thread.PostUIMessageEx(UIMsg_TileWindows, 0, "", {RunState.Execution.AsExecution, Locals.newExecution}, True)

 

2018-03-30_111720.png

 

The example implements the following UI message codes:

 

  • UIMsg_CascadeWindows -  instructs the sequence editor to create a separate tabbed group containing the windows.
  • UIMsg_TileWindows -  instructs the sequence editor to create a separate pane for each item specified.  
  • UIMsg_DisplayReport - instructs the sequence editor to display the report for the specified execution.
  • UIMsg_CloseWindows - instructs the sequence editor to close a window, such as an execution or sequence file window.
  • UIMsg_OpenWindows - instructs the sequence editor to open a window, such as an execution or sequence file window. 
  • UIMsg_RefreshWindows - instructs the sequence editor to refresh the specified sequence file or execution.  For sequence files, the string parameter can be used to specify a specific sequence to display. 
    If NULL is passed to the activeX Parameter, all sequence files and executions are refreshed.

For more details on the specific parameters that are supported for each of these UI message codes, refer to TestStand Help: UIMessageCodes Enumeration

 

Note: If these UI messages are posted within a UI which does not support these message codes, they will have no effect, but will not cause any errors.

 

Hardware and Software Requirements

Interacting with Sequence Editor UI Messages - TS2012.seq

TestStand 2012 or Compatible

 

Steps to Implement or Execute Code

  1. (Recommended) Enable On-The-Fly reporting
    1. Navigate to Configure » Result Processing.
    2. Select the settings button for the report plug-in.
    3. Enable the On-The-Fly Reporting option.
  2. Open the attached sequence and execute it using Execute » Single Pass.
  3. Read the message popups to see the behaviors for each UI Message Code.

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.