NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

loading a separate StationGlobals file

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.

0 Kudos
Message 1 of 5
(4,381 Views)

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.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 5
(4,362 Views)

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

Message 3 of 5
(4,333 Views)

Thanks to both -- I got both methods working.

 

Thanks!

0 Kudos
Message 4 of 5
(4,321 Views)

Ravi's method is safer.  Then you don't have to set the station globals back.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 5
(4,317 Views)