Description
Use the GetObjectByName
method to obtain a program object by its name.
Declaration
IntegrationObj.GetObjectByName(ObjectName)
IntegrationObj | An expression, variable or parameter that specifies a reference to an Integration object | |||
ObjectName | [in] | Required | String | |
Result | Object |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameter:
ObjectName
Specifies the name of the desired program object.
Result Value
A reference to the specified program object or an empty Variant value, if the specified object does not exist or is unavailable.
Remarks
The method returns the program object only if TestComplete is running script routines. If the script code is not running, the method returns an empty Variant value.
Example
The code below demonstrates how you can use the GetObjectByName
method to access TestComplete project variables.
Visual Basic
Sub Test()
Dim TestCompleteApp As TestCompleteApplication
Dim IntegrationObject As ItcIntegration
Dim LastResult As ItcIntegrationResultDescription
' Create an application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication.15")
' Obtain an integration object
Set IntegrationObject = TestCompleteApp.Integration
' Obtain the Project program object
Set ProjectObj = IntegrationObjectj.GetObjectByName("Project")
' Obtain the variable collection
Set VarCol = ProjectObj.Variables
' ....
' Close TestComplete
TestCompleteApp.Quit
End Sub
Dim TestCompleteApp As TestCompleteApplication
Dim IntegrationObject As ItcIntegration
Dim LastResult As ItcIntegrationResultDescription
' Create an application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication.15")
' Obtain an integration object
Set IntegrationObject = TestCompleteApp.Integration
' Obtain the Project program object
Set ProjectObj = IntegrationObjectj.GetObjectByName("Project")
' Obtain the variable collection
Set VarCol = ProjectObj.Variables
' ....
' Close TestComplete
TestCompleteApp.Quit
End Sub