NetworkSuite.GetRemoteOLEObject Method

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

The GetRemoteOLEObject method returns an OLE object that resides on a remote computer. If the desired OLE object is not running, GetRemoteOleObject launches it. If the method cannot connect to the desired object within a minute, an error occurs.

Declaration

NetworkSuite.GetRemoteOLEObject(AddressNameDomainUserNamePassword)

Address [in]    Required    String    
Name [in]    Required    String    
Domain [in]    Required    String    
UserName [in]    Required    String    
Password [in]    Required    String    
Result Variant

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Address

The host name or the IP address of the computer that hosts the needed OLE object.

Name

Either the program id (for example, Word.Application), or the class id (CLSID, for instance, {000209FF-0000-0000-C000-000000000046}) of the OLE object you want to obtain.

Domain

The domain the remote computer belongs to.

UserName

The name of the account you want to use to log in to the remote computer where you want to obtain the OLE object.

Password

The password of the user account you want to use to log in to the remote computer.

Result Value

The requested OLE object.

Remarks

GetRemoteOleObject is mainly used to return an OLE object from a remote computer rather than from the current one. Unlike the Sys.OleObject property, GetRemoteOleObject does not require configuring DCOM properties on the target remote computer, set appropriate permissions for this computer, etc. You only need to make sure that the TestComplete 14 Service is running on the target computer, and GetRemoteOleObject will be able to access it.

Example

The following example demonstrates how to obtain the OLE object residing on the remote computer.

JavaScript, JScript

function NetworkSuiteSample()
{
  // Specifies the name of the remote computer
  var Address = "TEST-XP32";
  // Specifies the name of the OLE server
  var Name = "Excel.Application";
  // Specifies the information on the account used to log in to the remote computer
  var Domain = "EGDS";
  var UserName = "tester";
  var Password = "123";

  // Obtains the OLE object residing on the remote computer
  var Excel = NetworkSuite.GetRemoteOLEObject(Address, Name, Domain, UserName, Password);
  …

}

Python

def NetworkSuiteSample():
  # Specifies the name of the remote computer
  Address = "TEST-XP32"
  # Specifies the name of the OLE server
  Name = "Excel.Application"
  # Specifies the information on the account used to log in to the remote computer
  Domain = "EGDS"
  UserName = "tester"
  Password = "123"
  # Obtains the OLE object residing on the remote computer
  Excel = NetworkSuite.GetRemoteOLEObject(Address, Name, Domain, UserName, Password)

VBScript

Sub NetworkSuiteSample

  ' Specifies the name of the remote computer
  Address = "TEST-XP32"
  ' Specifies the name of the OLE server
  Name = "Excel.Application"
  ' Specifies the information on the account used to log in to the remote computer
  Domain = "EGDS"
  UserName = "tester"
  Password = "123"

  ' Obtains the OLE object residing on the remote computer
  Set Excel = NetworkSuite.GetRemoteOLEObject(Address, Name, Domain, UserName, Password)
  …

End Sub

DelphiScript

procedure NetworkSuiteSample;
var Address, Name, Domain, UserName, Password, Excel;
begin
  // Specifies the name of the remote computer
  Address := 'TEST-XP32';
  // Specifies the name of the OLE server
  Name := 'Excel.Application';
  // Specifies the information on the account used to log in to the remote computer
  Domain := 'EGDS';
  UserName := 'tester';
  Password := '123';

  // Obtains the OLE object residing on the remote computer
  Excel := NetworkSuite.GetRemoteOLEObject(Address, Name, Domain, UserName, Password);
  …

end;

C++Script, C#Script

function NetworkSuiteSample()
{
  // Specifies the name of the remote computer
  var Address = "TEST-XP32";
  // Specifies the name of the OLE server
  var Name = "Excel.Application";
  // Specifies the information on the account used to log in to the remote computer
  var Domain = "EGDS";
  var UserName = "tester";
  var Password = "123";

  // Obtains the OLE object residing on the remote computer
  var Excel = NetworkSuite["GetRemoteOLEObject"](Address, Name, Domain, UserName, Password);
  …

}

See Also

Distributed Testing
OleObject Property

Highlight search results