Reflection
RunExpressMacro Method
Example 


Specifies the fully qualified file name of the macro to run.
Runs an Express macro.
Syntax
'Declaration
 
Sub RunExpressMacro( _
   ByVal macroName As String _
) 
'Usage
 
Dim instance As IMacro
Dim macroName As String
 
instance.RunExpressMacro(macroName)
void RunExpressMacro( 
   string macroName
)

Parameters

macroName
Specifies the fully qualified file name of the macro to run.
Exceptions
ExceptionDescription
System.IO.FileNotFoundException Thrown if the macro file does not exist.
Example
Run an Express Macro
//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);                
            }            
        }


    }
}

See Also