Automate Reflection 2011
Using Reflection objects and their methods and properties, you can control Reflection 2011 from applications that use Automation (such as Microsoft Word and Excel), or custom applications that you write in standalone Visual Basic.
By automating Reflection 2011, 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.
Note: This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Attachmate provides this sample code "AS IS" with no warranties.
To automate Reflection 2011
- Declare an object variable for the Reflection object:
Sub automateReflection()
Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
- Assign the Application object to the object variable. The following code creates an instance of Reflection 2011:
Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
- 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
- Declare a variable to hold the file path to the session document file you want to open.
Dim path As String
Assign the fully qualified path of the file to this variable. For example:
path = Environ$("USERPROFILE") & "\Documents\Attachmate\Reflection\" & "fileName.rd3x"
- Create controls to open and display the session document.
Set frame = App.GetObject("Frame")
Set terminal = app.CreateControl(path)
Set view = frame.CreateView(terminal)
frame.Visible = True
End Sub
|