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;
}
}
}