InfoConnect API Guide
Attachmate.Reflection.Emulation.IbmHosts Namespace / IIbmTerminal Interface / ConnectAction Property
Example


In This Topic
    ConnectAction Property (IIbmTerminal)
    In This Topic
    Gets or sets a sequence of action(s), such as running a macro, to run automatically after a connection is established.
    Syntax
    'Declaration
     
    
    Property ConnectAction As InputMapActionSequence
    'Usage
     
    
    Dim instance As IIbmTerminal
    Dim value As InputMapActionSequence
     
    instance.ConnectAction = value
     
    value = instance.ConnectAction
    InputMapActionSequence ConnectAction {get; set;}
    Exceptions
    ExceptionDescription
    This exception is thrown if the set parameter is longer than the maximum allowed.
    This exception is thrown when you modify a property that was secured via the Permissions Manager or that can only be modified by an Administrator.
    Remarks
    Connect action sequences run after the terminal has successfully made a connection to the host. They should not include session setup information.
    Example
    This sample opens a session document and assigns a sequence that runs a connection macro to the ConnectAction property. When the session connects or is reconnected, the macro runs.
    using System;
     
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.UserInterface;
     
    namespace SetConnectAction
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Start a visible instance of InfoConnect or get the instance running at the given channel name
                Application app = MyReflection.CreateApplication("myWorkspace", true);
     
                //Create a terminal from the session document file
                string sessionPath = Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\InfoConnect\test.rd3x";
                IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(sessionPath);
     
                //Make the session visible in the workspace
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
     
     
                //Create an action and add it to an action sequence
                object [] parameters = { "Recorded.MyConnectMacro", MacroEnumerationOption.Document, false};
                InputMapAction action = new InputMapAction(InputMapActionID.RunMacroAction, parameters);
     
                InputMapActionSequence sequence = new InputMapActionSequence();
                sequence.Add(action);
     
                terminal.ConnectAction = sequence;
     
                terminal.RunMacroAtReconnect = true;        
            }
        }
    }
    See Also