Getting the Directory Path of a Sequence File in Teststand

Updated Apr 21, 2023

Reported In

Software

  • TestStand 2017

Issue Details

I am creating a CSV file in TestStand and would like to have it inside the same directory folder of the sequence file. I know you can make use of an expression to specify the file path name. But what is the correct expression to get the Sequence file directory path?

Solution

The property SequenceFile.Path returns the path name TestStand used when the sequence file was last saved or loaded. In other words, you can get the directory path of the current sequence file by parsing the string value read from this property. Below is the required expression to do so:

Left(RunState.SequenceFile.Path, Find(RunState.SequenceFile.Path, "\\", 0, False, True))
 

For example, if the property SequenceFile.Path has a string value: "C:\Users\PC-Test\Documents\Sequence 1.seq"

The expression will return the following string: "C:\Users\PC-Test\Documents"

Additional Information

The details on the TestStand functions used in the solution can be found in the following: Left() and Find() .

TestStand 2017 provides a shipping example called Using Data Streams, which uses the above expression. Below is the screenshot of the sequence file: