Show Contents / Index / Search

Get Started (OpenSystems)

using System;

using System.Collections.Generic;

using System.Text;

using Attachmate.Reflection.Framework;

using Attachmate.Reflection.Emulation.OpenSystems;

 

namespace GetStartedConsole

{

  class Program

  {

    static void Main(string[] args)

    {

      Attachmate.Reflection.Framework.Application reflectionApplication = MyReflection.CreateApplication();

      if (reflectionApplication != null)

      {

        object[] terminals = reflectionApplication.GetControlsByFilePath(@"C:\Users\[user name]\Documents\Attachmate\Reflection\[session filename]");

        if (terminals != null && terminals.Length > 0)

        {

          ITerminal terminal = (ITerminal)terminals[0];

          IScreen screen = terminal.Screen;

          string text = screen.GetText(18, 2, 48);

          Console.WriteLine(text);

        }

        else

          Console.WriteLine("No such control exists. Check to make sure that the session from the file is running.");

      }

      else

        Console.WriteLine("Failed to get Application object.");

    }

  }

}