1.用ORAOM对象来修改属性:
Dim autoRepository,TOCollection,testobject,i '声明变量
Set autoRepository = CreateObject("Mercury.ObjectRepositoryUtil") '创建ORAOM对象
autoRepository.Load "H:/YFSoftwareTest/Lite/Repository/linshi.tsr" '导入对象库文件
Set TOCollection = autoRepository.GetAllObjectsByClass("WinButton") '获取所有链接类的对象集合
For i=0 To TOCollection.count-1 '遍历所有测试对象
Set testobject = TOCollection.item(i) '获取测试对象
If autoRepository.GetLogicalName(testobject) = "图片" Then '判断对象名称为“知道”执行一下操作
testobject.SetTOproperty "text","text" '更改对象库的TEXT属性为“图 片”
autoRepository.UpdateObject testobject '更新对象
autoRepository.RenameObject testobject,"图片" '重命名对象名称
autoRepository.Save '保存对象库
Exit For '退出循环
End If
Next
Set testobject = Nothing
Set TOCollection = Nothing
Set autoRepository = Nothing
'释放所有对象
2.对象库导出XML,用XMLDOM删除节点的方法,再导回成对象库
Dim autoRepository
Set autoRepository = CreateObject("Mercury.ObjectRepositoryUtil") '创建ORAOM对象
autoRepository.ExportToXML "C:/xxx.tsr","C:/xxx.xml"
autoRepository.ImportFromXML "C:/xxx.xml","C:/xxx.tsr"
Set autoRepository = Nothing