Hi,
Below is my function that uses Storages object in Test complete. I tried putting the same code in Script extension. But got the error message 'Object required'. because Script extension doesn't support Storages object.
can any one please give me equivalent vb script code for the same?
sSecName = "LanguageList"
sArrSubSec = "English"
sOptionName = "ShortDateFormat"
sXMLFile = "D:\Arun\ScrExtProjectSuite\Stores\Test Data\TestData_TestAutomation2.xml"
Function FetchValueFromXML(sXMLFile,sSecName,sArrSubSec, sOptionName)
Note: This function returns Value of an Option of a Section/subsection in XML
'Variables
Dim sSubSec,arrSubSec
'Read the data from XML file
Set FileSection =Storages.XML(sXMLFile)
Set sSection = FileSection.GetSubSection(sSecName)
'Subsections are separated by "#"
arrSubSec= split(sArrSubSec,"#")
' log.Message arrSubSec(0)& arrSubSec(1)
'Traverse subsection hierarchy and get the expected Section
For i = 0 toUBound(arrSubSec)
if arrSubSec(i) <> "" then
'arrSubSec(i) <> Null AND
Set sSubSec= sSection.GetSubSection(arrSubSec(i))
Set sSection= sSubSec
EndIf
Next
'Get the Value of the Option in sub section
If sSubSec.OptionExists(sOptionName) Then
sVal = Trim(sSubSec.GetOption(sOptionName, Null))
FetchValueFromXML= sVal
Else
FetchValueFromXML= Null
EndIf
EndFunction
html file is attached along