Creating COM references

Before you can create references to COM objects, you must link to the type library that describes the objects to which you want to make references. Creating a link to a type library is described in COM Libraries.

Data types

Both global and local data types can refer to COM objects. To create a data type that refers to a specific type of COM object, use the following procedure.

  1. Create a new data type.

Use the Data Type Definition window to create a new global data type, or the Local Field Definition window to create a data type for a local field.

  1. Specify a Reference control type.

In the Control Type drop-down list, specify Reference.

  1. Select the type of reference.

Use the Reference Type drop-down list to specify COM Object as the reference type.

  1. Select the COM object to refer to.

Click the COM Object Type lookup button to display the Class Browser window. Use this window to indicate the type of COM object to refer to. For example, the following illustration shows creating a reference to an Acrobat PDF document.


Click Select. The name of COM object type you selected will appear in the COM Object Type field.

  1. Save the data type.

Click OK to save the COM Reference data type. The following illustration shows the data type that refers to an Acrobat PDF document.


Script variables and parameters

You can create local variable and script parameters that refer to COM objects. To do this, simply use the COM object type in the declaration of the variable or parameter. For example, the following is the declaration of a local variable that can refer only to an Acrobat PDF document.

local Acrobat.CAcroAVDoc current_document;

Notice that the type used for the variable is Acrobat.CAcroAVDoc, which indicates the variable can refer only to objects that are of the type CAcroAVDoc as defined in the Acrobat type library.

You can use the Class Browser window from within the Script Editor to make looking up COM object types much easier. This is described in Class Browser.


Documentation Feedback