//This sample starts an Ibm 3270 session and runs an Express macro.
//It also uses the ExpressMacroStarted and ExpressMacroCompleted events to display messages
//when the macro starts and when it has completed.
using System;
namespace RunActions
{
using System.Diagnostics;
using System.Windows.Forms;
using Attachmate.Reflection.Emulation.IbmHosts;
using Attachmate.Reflection.Framework;
using Attachmate.Reflection.UserInterface;
using Application = Attachmate.Reflection.Framework.Application;
class Program
{
public static void Main(string[] args)
{
MyReflection.Start();
Application app = MyReflection.CreateApplication();
IFrame frame = (IFrame)app.GetObject("Frame");
if (frame != null)
{
//Get a new terminal and screen
IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(new Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}"));
IIbmScreen screen = terminal.Screen;
//Assign the host address to the Reflection onboard demo
terminal.HostAddress = "demo:ibm3270.sim";
frame.CreateView(terminal);
IMacro macro = terminal.Macro;
if (macro != null)
{
macro.ExpressMacroStarted += (sender, eventArgs) =>
{
MessageBox.Show("Express Macro Started!!!");
};
macro.ExpressMacroCompleted += (sender, eventArgs) =>
{
MessageBox.Show("Express Macro Completed!!!");
};
macro.RunExpressMacro(Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\Reflection\Macros\Express\test.js");
}
Console.ReadLine();
app.Close(ApplicationCloseOption.CloseNoSave);
}
}
}
}