Admin Production rocket
Current Publication

GetControlsByFilePath Method

InfoConnect Desktop InfoConnect VBA Guide V17.0
Rocket® InfoConnect Desktop (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.
Session file path.
GetControlsByFilePath Method
In This Topic
Gets a collection of controls by the session file path.
Syntax

                     
                     
expression.GetControlsByFilePath( _
   ByVal filePath As String _
) As Object()

                  
where expression is a variable that represents a ApplicationObject Object

Parameters

filePath
Session file path.

Return Value

The method returns a collection of terminal controls whose session file path matches the

filePath.

Remarks
This path may not be unique among all running sessions.
Example
This example gets a handle to an IBM terminal control by its file path and toggles the connection state for the control.
Sub GetControls()
    Dim sessionPath As String
    Dim controls() As Variant
    
    'Declare an object variable for the Application Object
    Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
    
    'Get a handle to the Application object
    Set app = GetObject("InfoConnect Workspace")
 
    'Get the control with this file path
    'Edit the next statement to contain the name of your session
    sessionPath = Environ("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\Accounts.rd3x"
    controls = app.GetControlsByFilePath(sessionPath)
    
    'Check to make sure the session is running
    If UBound(controls) = -1 Then
        Exit Sub
        Else
        'Toggle the connection state for the control
            If controls(0).IsConnected Then
            controls(0).Disconnect
        Else
            controls(0).Connect
        End If
 
    End If
          
End Sub
See Also