Quick Start > Dynamically Open a Session |
You can open or close sessions dynamically. This example shows how to open a terminal session from another session that is running in the InfoConnect workspace.
![]() |
You can open only sessions that are saved in trusted locations (Documents/Micro Focus/InfoConnect is a default trusted location). For information about trusted locations and how to add them, see the InfoConnect Help. |
Open a session document from InfoConnect |
Copy Code
|
---|---|
Sub OpenSessionDocument() 'InfoConnect objects required to open a new session Dim app As Attachmate_InfoConnect_Objects_Framework.ApplicationObject Dim terminal As Attachmate_InfoConnect_Objects_Emulation_IbmHosts.IbmTerminal Dim view As Attachmate_InfoConnect_Objects.View Dim sessionPath As String 'Get a handle to the existing application object (the workspace) Set app = GetObject("InfoConnect Workspace") 'Create a terminal control for the new session sessionPath = Environ$("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\" & "gettingStarted.rd3x" Set terminal = app.CreateControl(sessionPath) 'Create the view used to display the session Set view = ThisFrame.CreateView(terminal) End Sub |
Open a session document from InfoConnect |
Copy Code
|
---|---|
Sub OpenSessionDocument() 'InfoConnect objects required to open a new session Dim app As Attachmate_InfoConnect_Objects_Framework.ApplicationObject Dim terminal As Attachmate_InfoConnect_Objects_Emulation_OpenSystems.Terminal Dim view As Attachmate_InfoConnect_Objects.View Dim sessionPath As String 'Get a handle to the existing application object (the workspace) Set app = GetObject("InfoConnect Workspace") 'Create a terminal control for the new session sessionPath = Environ$("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\" & "gettingStarted.rdox" Set terminal = app.CreateControl(sessionPath) 'Create the view used to display the session Set view = ThisFrame.CreateView(terminal) End Sub |
Open a session document |
Copy Code
|
---|---|
Sub OpenUTSSessionDocument() 'Reflection objects required to open a new session Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject Dim terminal As Attachmate_Reflection_Objects_Emulation_UTS.UtsTerminal Dim View As Attachmate_Reflection_Objects.View Dim sessionPath As String 'Get a handle to the existing application object (the workspace) Set app = GetObject("InfoConnect Workspace") 'Create a terminal control for the new session sessionPath = Environ$("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\" & "gettingStarted.iuts" Set terminal = app.CreateControl(sessionPath) 'Create the view used to display the session Set View = ThisFrame.CreateView(terminal) End Sub |
Open a session document |
Copy Code
|
---|---|
Sub OpenT27SessionDocument() 'Reflection objects required to open a new session Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject Dim terminal As Attachmate_Reflection_Objects_Emulation_T27.T27Terminal Dim View As Attachmate_Reflection_Objects.View Dim sessionPath As String 'Get a handle to the existing application object (the workspace) Set app = GetObject("InfoConnect Workspace") 'Create a terminal control for the new session sessionPath = Environ$("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\" & "gettingStarted.it27" Set terminal = app.CreateControl(sessionPath) 'Create the view used to display the session Set View = ThisFrame.CreateView(terminal) End Sub |
To open a session, you'll need access to the Application, IbmTerminal (IBM) or Terminal (Open Systems), and View objects:
For more about these objects, see Using the InfoConnect Object Model.
You can also create this macro in a Common project module and then call it to open this session. Macros in the Common project can be called by any session or by workspace actions. For more about this, see Sharing and Referencing Macros and Controlling Macro Execution.