Micro Focus QTP (UFT) Forums
Object Repository - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Object Repository (/Thread-Object-Repository--557)



Object Repository - dbarori - 05-26-2008

Can you please tell me how can we associate and diassociate object repository programmatically?


RE: Object Repository - avykunt - 05-26-2008

Code:
Set App=CreateObject("QuickTest.Application")      ' Creating an  Application Object
Set ORS=App.test.Actions("Action1").ObjectRepositories            ' Get the Object repository collection of the Action called Action1
'**********************ASSOCIATING OR***********************
If ORS.find("C:\ObjectRepositoryfile.tsr")=-1 Then             'If the specified repository is not found in the Object Repository collection of Action1 then
    ORS.add("C:\ObjectRepositoryfile.tsr")                    ' Associate this Shared Object Repository to the Object Collection of Action1
End If
'**********************DIASSOCIATING OR*********************
If ORS.find("C:\ObjectRepositoryfile.tsr")<>-1 Then             'If the specified repository is found in the Object Repository collection of Action1 then
    ORS.Remove("C:\ObjectRepositoryfile.tsr")                    ' Remove this Shared Object Repository from the Object Collection of Action1
End If
Regards,
Anil.