Dim qtApp, qtRepositories, lngPosition
'Open QuickTest and create the Application object
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True
'Open a test and get the "Login" action's object repositories collection
qtApp.Open "D:\Fatima\trial-qtp\adv topics\Test1", False, False
Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories
' Add shared_rep.tsr if it's not already in the collection
If qtRepositories.Find("D:\Fatima\trial-qtp\adv topics\shared_rep.tsr") = -1 Then ' If the repository cannot be found
qtRepositories.Add "D:\Fatima\trial-qtp\adv topics\shared_rep.tsr", 1
End If
' If additional_rep.tsr is moved down the list - place it back at position 1
If qtRepositories.Count > 1 And qtRepositories.Item(1) = "D:\Fatima\trial-qtp\adv topics\additional_rep.tsr" Then
qtRepositories.MoveToPos 1,2
End If
' If debug.tsr is in the collection - remove it
lngPosition = qtRepositories.Find("D:\Fatima\trial-qtp\adv topics\debug.tsr")
If lngPosition <> -1 Then
qtRepositories.Remove lngPosition
End If
' Set the new object repository configuration as the default for all new actions
qtRepositories.SetAsDefault
qtApp.Test.Save
qtApp.Quit
Set qtRepositories = Nothing
Set qtApp = Nothing