Show Contents / Index / Search

Automate Reflection 2008

Using Reflection objects and their methods and properties, you can control Reflection 2008 from applications that use Automation (such as Microsoft Word and Excel), or custom applications that you write in standalone Visual Basic.

By automating Reflection 2008, you can perform emulation tasks (such as extracting data or sending instructions) without ever leaving the application. For a list of Reflection objects, methods, and properties, see the Reflection language reference in the Microsoft Visual Basic Help.

To automate Reflection 2008

  1. Declare an object variable for the Reflection object:

    Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject

  2. Assign the Application object to the object variable. The following code gets an existing instance of the application, if Reflection is running, or creates a new one, if it isn't running:

    Set app = GetObject("Reflection Workspace")

  3. Declare additional Reflection objects, such as Frame, Terminal, and View:

    Dim frame As Attachmate_Reflection_Objects.frame

    Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal

    Dim view As Attachmate_Reflection_Objects.view

  4. Create controls to open and display an existing session document. For the file path, include the drive letter and filename of the session document. For example: "C:\Users\[user name]\Documents\Attachmate\Reflection\filename.rd3x".

    Set frame = app.GetObject("Frame")

    Set terminal = app.CreateControl("[filepath]")

    Set view = frame.CreateView(terminal)