From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Generate a List of All Code Modules Used by a TestStand Sequence File

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 tool creates a text report containing all the code modules (VIs, DLLs, .NET Assemblies, ActiveX Servers, and sequence files) that are called by sequence files in user-selected directories.  The tool generates a report of all sequence files processed, and all code modules referenced by each sequence file.

Description

Use this tool to generate a report containing all the code modules used by a sequence file without having to look at every step to check the location of the module it calls.  This tool uses the ForEach.seq seuqence file that ships with TestStand to implement much for the core functionality.  The sequence calls the following sequences in the ForEach.seq sequence file:

 

  • FindFiles - Returns a list of all files in the specified directory.  The example uses this sequence to find the sequence files to process in each user-selected directory
  • ForEachStepInPathList - executes a callback sequence for each step in a set of sequence file paths.  The example uses this sequence to check the module of each step (The example defines RunForEachStep as the callback sequence which executes on each step).

 

For each step, the example first checks the type of module using the Step.AdapterKeyName property, then casts the module object to the corresponding specific class.  For example, if the Step.AdapterKeyName property is FlexLVAdapterKeyName (this is a string constant for "G Flexible Prototype Adapter"), the sequence casts the module object to the LabVIEWModule class, using Module.AsLabVIEWModule.  This allows access to properties and methods specific to LabVIEW modules, such as the LabVIEWModule.VIPath property.

 

Note that in order to successfully distribute your sequence file, it is recommended that you use the TestStand Deployment Utility so that the code modules as well as their dependencies are also pulled into the distribution. 

Hardware and Software Requirements

List All Code Module Paths - TS2_0.seq

TestStand 2.0 or Compatible

 

List All Code Module Paths - TS4_0.seq

TestStand 4.0 or Compatible

 

List All Code Module Paths - TS2012.seq

TestStand 2012 SP1or Compatible

Steps to Implement or Execute Code

TestStand 2012 example:

  1. Run the GetAllModulePaths sequence using Execute » Run GetAllModulePaths
  2. When prompted, select one or more directories
  3. View the report containing all processed sequence files and the modules they reference

TestStand 4.0/2.0 Example:

  1. Navigate to: <TestStand Public>\Components\Tools ("<TestStand>\Components\User\Tools" for TestStand 4.0 and earlier)
  2. Unzip the contents of the file ListCodeModulePaths.zip into the folder named in Step 1 (this will create a folder "List Code Module Paths" in the Tools directory)
  3. Copy the file named "List Code Module Paths.ini" to the folder <TestStand Public>\Setup\ToolMenusToInstall ("<TestStand>\Setup\ToolMenusToInstall" for TestStand 4.0 and earlier). Create this folder if it does not already exist. This will add the tool to the "Tools" menu with the name of "List Code Module Paths...".
  4. If the sequence editor or user interface is open, you will need to restart the application.

Usage

  1. Open the sequence file you are interested in.
  2. Go to Tools»List Code Module Paths. This option is disabled when there is no sequence file open.
  3. When prompted, select a location and name of the report file that will be generated by this tool.

Additional Information or References

Example Program: Creating a Sequence File Iteration Tool - Replacing Absolute Module Paths with Rela...

 

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.