Programmatically Updating a Configuration File

TestStand 2017 Help

Edition Date: November 2017

Part Number: 370052W-01

»View Product Info

Download Help (Windows Only)
NI TestStand 2014 Help
NI TestStand 2014 SP1 Help
TestStand 2016 Help
TestStand 2016 SP1 Help
TestStand 2017 Help

If you deploy a new model plug-in to an existing TestStand installation and you want to automatically add an instance of the new plug-in to an existing configuration file, call the AddResultProcessingPluginToConfiguration or AddModelPluginToConfiguration functions in ModelSupport2.dll as defined in ResultProcessing.h located in the <Teststand>\Components\Models\TestStandModels directory.

You can call RemoveResultProcessingPluginFromConfiguration or RemoveModelPluginFromConfiguration to remove instances of a plug-in from a configuration file.

If you want to make arbitrary edits to an existing configuration file, you can load and save the file with the PropertyObjectFile interface. You can paste the following expression into a Statement step to create an example of how to modify a configuration file:

Locals.File = RunState.Engine.NewPropertyObjectFile(FileType_PropertyObjectFile), // don't forget to create Locals.File as an Object Reference variable

Locals.File.AsPropertyObjectFile.Path = RunState.Engine.GetTestStandPath(TestStandPath_Config) + "\\ModelPlugins\\ResultProcessing.cfg",

Locals.File.AsPropertyObjectFile.ReadFile(ConflictHandler_Error), // load the configuration file

// add expressions to change values as desired under: Locals.File->Data.ModelPluginConfigurationSet

Locals.File.AsPropertyObjectFile.WriteFile(WriteFileFormat_Current) // write back any changes to the configuration file


Not Helpful