Example Programs

Showing results for 
Search instead for 
Did you mean: 

Using the TestStand API to Add Items to the Templates List


This example shows how to programmatically create new Step, Variable, and Sequence templates in the sequence editor using the TestStand API.



In order to create new templates, this example completes the following steps:


  1. Access the Templates file using the Engine.

    Locals.templatesFile= RunState.Engine.GetTemplatesFile(0)
  2. Use the PropertyObjectFile method to access the data within the templates file, and add the new template items as subproperties.  Use the clone method to create a new instance of the new item to be used as a template.

    Locals.templatesFile.AsPropertyObjectFile.Data.Root["Steps"].SetPropertyObjectByOffset(0,1,RunState.SequenceFile.GetSequenceByName("Template").GetStepByName("Test Step", StepGroup_Main).AsPropertyObject.Clone("", 0))
  3. Increment the change count of the file.

  4. Refresh the window to update the templates pane.



Hardware and Software Requirements

Dynamic Template Insertion - TS2012.seq

TestStand 2012 or Compatible


Steps to Implement or Execute Code

  1. Open the attached sequence file, and execute it using Execute » Run MainSequence. 
  2. Once the sequence runs, observe that the templates have been updated in the sequence editor.



Manooch H.
National Instruments