How Do I Change the Default Directory for the Open File Dialog in TestStand?

Updated Nov 3, 2024

Environment

Software

  • TestStand 2014
  • TestStand 2014 SP1
  • TestStand 2016
  • TestStand 2016 SP1
  • TestStand 2019

Whenever I launch TestStand (either using the TestStand Sequence Editor or any Operator Interface) and select File»Open File..., the File Dialog box always points to my TestStand installation directory. How do I set a different default directory?

The Open File dialog starts in the current directory set by your operating system. When you launch TestStand, there are several files that are loaded from <TestStand> directory. This causes Windows to set the current directory to be <TestStand>. You can change the current directory by calling the SetCurrentDirectoryA() function inside of kernel32.dll Windows dll. You could call this function from FrontEndCallbacks sequence file since it executes every time you launch TestStand. Follow these steps to accomplish this:

  1. Open the FrontEndCallbacks.seq sequence file from <TestStand Public>\Components\Callbacks\FrontEnd\
     
  2. If the FrontEndCallbacks.seq file is empty, please replace it with a copy from <TestStand>\Components\Callbacks\FrontEnd, otherwise proceed to step 3. You should never modify the default TestStand files; always use a copy instead.
     
  3. Select the LoginLogout sequence from the Sequences pane.
     
  4. Select the C/C++ DLL adapter as the default adapter.
     
  5. Insert an Action step above the Logout step. Name the new step Set Current Directory.
     
  6. Right-click on the Set Current Directory step and select Specify Module... from the popup menu.
     
  7. Enter kernel32.dll as the Module path.
     
  8. Select SetCurrentDirectoryA from the Function ring control.
     
  9. You may see a dialog box that notifies you that "This function does not have parameter information in the DLL or uses types not recognized by TestStand". Select OK
     
  10. Click the Add button to create a new parameter.
     
  11. Enter CurrentDirectory for the parameter name, replacing the default arg1.
     
  12. Choose String for the Category and C String (const) for Type.
     
  13. Enter the directory you want as you initial directory in the Value Expression text box. Make sure to enclose this in double quotes and use double back slashes in your path (e.g. C:\\Temp\\MyDirectory).
     
  14. Save the FrontEndCallbacks.seq file.
  15. copy from <TestStand>\Components\Callbacks\FrontEnd the folder WIN32 and paste it into folder <TestStand Public>\Components\Callbacks\FrontEnd\ 

Now when you launch TestStand and select File»Open File..., your initial path will be the one you selected.

Additional Information

<TestStand> refers to TestStand installation directory.
<TestStand Public> refers to TestStand Public directory.
Please refer to TestStand Directory Structure  help page for default paths.