cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative for Storages object in Script Extention that doesn't support Storages object

Highlighted
Occasional Contributor

Alternative for Storages object in Script Extention that doesn't support Storages object

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 to UBound(arrSubSec)

if arrSubSec(i) <> "" then 

'arrSubSec(i) <> Null AND

Set sSubSec= sSection.GetSubSection(arrSubSec(i))

Set sSection= sSubSec

End If

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

End If

End Function

 

html file is attached along

New Here?
Join us and watch the welcome video:
Building with the Collaborator API

Help Documenation
The Collaborator API is a JSON-RPC API that lets you integrate with Collaborator 9.0 and above. For more information about how the API works, check out the API description here:


Sample Plugins
For an example of an add-in that uses the API, take a look at the Microsoft Word Add-in for Collaborator:


We list all the great plugins our network has already built on this page on the SmartBear website.

Labels