Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Framework Library / Attachmate.Reflection.Objects.Framework Library / ApplicationObject Object / GetControlsByFilePath Method
Session file path.
Example
In This Topic
    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("Reflection 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\Reflection\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