10-22-2015 06:36 PM
I've got a case where I have a running TestStand execution (happens to be TS2012)
I have a separate StationGlobals.ini file from ANOTHER computer/station/instance (is in a different location on harddrive with different file name, eg Station2SG.ini)
I want to be able to load Station2SG.ini into a propertyobject in TestStand (but not actually load into and overwrite my existing StationGlobals.* of my current execution -- I just want to interrogate the values in the file.
Unfortunately the file is NOT the simple xml or ini file that I could read with another utility and parse values out, and I'm stuck with that format.
Any suggestions for how to load the values of that file into PropertyObject.*? I've tried ReadPropertyObjectFile() but that doesn't work for StationGlobals files.
10-23-2015 11:11 AM - edited 10-23-2015 11:12 AM
Not sure if this will work for you but you can trick it. Change the path and then change it back.
Just a thought. Check out the example.
You will need to change the NewPath in the Set File Paths step.
10-26-2015 03:53 AM
Hi,
I tried this with the existing stationglobals.ini.It should work with other stationglobals.ini files also.
1) Insert a statement step : (locals.file is a object ref type)
Locals.File = RunState.Engine.NewPropertyObjectFile(FileType_PropertyObjectFile),
Locals.File.AsPropertyObjectFile.Path = RunState.Engine.GetTestStandPath(TestStandPath_Config) + "\\StationGlobals.ini", //Change path
Locals.File.AsPropertyObjectFile.ReadFile(ConflictHandler_Error), // loads the configuration file properties
2) To read/access a value do this in a statement :
Locals.str=Locals.File->Data.StrStationGlobal_1 // StrStationGlobal_1 is a string in my stationglobals
Hope this helps.
Ravi
10-26-2015 10:33 AM
Thanks to both -- I got both methods working.
Thanks!
10-26-2015 10:50 AM
Ravi's method is safer. Then you don't have to set the station globals back.