打印OR中的WebTables逻辑名

Dim ORUtil

'Create the object repository automation API

Set ORUtil = CreateObject("Mercury.ObjectRepositoryUtil")

 

'Load the object repository

ORUtil.Load "C:\temp\SharedOR.tsr"

 

'Get all the objects with class as WebTable

Set allTableObjects = ORUtil.GetAllObjectsByClass("WebTable")

 

'Print their full object path

For i = 0 to allTableObjects.Count - 1

Print GetObjectFullName(ORUtil.allTableObjects.item(i))

Next

 

'Destroy the object

Set ORUtil = Nothing

 

Function GetObjectFullName(ORUtil, obj)

Dim parentObject

Dim sObjectType

Dim sLogicalName

 

'Type of the object

sObjectType = obj.GetTOProperty("micclass")

 

'Get the logical name of the object

sLogicalName = ORUtil.GetLogicalName(obj)

 

'If Empty is returned by GetTOProperty then there is no parent

If IsEmpty(obj.GetTOProperty("parent")) Then

'No more parent

GetObjectFullName = sObjectType & "(""" & sLogicalName & """)"

Else

Set parentObject = obj.GetTOProperty("parent")

GetObjectFullName = GetObjectFullName(ORUtil, parentObject) & "." & sObjectType & "(""" & sLogicalName & """)"

End If

End Function

posted @ 2013-11-22 08:57  dushuai  阅读(125)  评论(0编辑  收藏  举报