Resources Property
Returns the Resources object, which enables you to specify the resources associated with the test or component.
Property type
Read-only property
Visual Basic
Public Property Resources As Resources
'This example opens a test, configures the test's libraries' collection
'and saves the test.
'There is no unsaved test currently open in UFT.
'For more information, see the example for the Test.SaveAs method.

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtLibraries 'As QuickTest.TestLibraries ' Declare a test's libraries collection variable
Dim lngPosition

' Open UFT
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Launch UFT
qtApp.Visible = True ' Set UFT to be visible

' Open a test and get its libraries collection
qtApp.Open "C:\Tests\Test1", False, False ' Open a test
Set qtLibraries = qtApp.Test.Settings.Resources.Libraries ' Get the libraries collection object

' Add Utilities.vbs if it's not in the collection
If qtLibraries.Find("C:\Utilities.vbs") = -1 Then ' If the library cannot be found in the collection
    qtLibraries.Add "C:\Utilities.vbs", 1 ' Add the library to the collection
End If

' If we "pushed" Math.vbs - place it back at position 1
If qtLibraries.Count > 1 And qtLibraries.Item(2) = "C:\Math.vbs" Then ' If there is more than one library and Math.vbs is in position 2
    qtLibraries.MoveToPos 1, 2 ' Switch between two first libraries
End If

' If Debug.vbs is in the collection - remove it
lngPosition = qtLibraries.Find("C:\Debug.vbs") ' Try finding the Debug.vbs library
If lngPosition <> -1 Then ' If the library was found in the collection
    qtLibraries.Remove lngPosition ' Remove it
End If

' Set the new libraries configuration as a default
qtLibraries.SetAsDefault ' Set library files associated with the test as default for new ones

'Save the test and close UFT
qtApp.Test.Save ' Save the test
qtApp.Quit ' Quit UFT

Set qtLibraries = Nothing ' Release the test's libraries collection
Set qtApp = Nothing ' Release the Application object
See Also