InfoConnect for Unisys
Attachmate.Reflection.Emulation.IbmHosts Namespace / IMacro Interface / RunExpressMacro Method
Specifies the fully qualified file name of the macro to run.
Example


In This Topic
    RunExpressMacro Method
    In This Topic
    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
    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 InfoConnect 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\InfoConnect\Macros\Express\test.js");                    
                    }
    
                    Console.ReadLine();
                    app.Close(ApplicationCloseOption.CloseNoSave);                
                }            
            }
    
    
        }
    }
    
    
    See Also