GetControlsByFilePath Method
Gets a collection of controls by the session file path.
expression.GetControlsByFilePath( _
ByVal 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.
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