You can use Reflection methods to navigate through your sessions:
Navigating Through IBM Screens
Navigating Through Open Systems Programs
Finding and Moving to Screen Locations
Using the NewScreenReady event along with the GetText function, you can identify specific screens when they are ready. You can then use the PutText and SendControlKey methods to enter commands that navigate to the next screen.
Navigate through screens using the NewScreenReady event |
Copy Code
|
---|---|
using System; using System.Collections.Generic; using System.Text; using Attachmate.Reflection.Framework; using Attachmate.Reflection.Emulation.IbmHosts; using Attachmate.Reflection.UserInterface; namespace Navigate { class Program { static void screen_NewScreenReady(object sender, EventArgs e) { IIbmScreen screen = (IIbmScreen)sender; //Get strings that are unique to each screen you want to navigate string screenID1 = screen.GetText(1, 2, 3); string screenID2 = screen.GetText(1, 1, 5); //Compare each screen ID with a known value to determine //which screen the program is on. Then use the SendKeys and //SendControlKey methods to navigate to the next screen if (screenID1 == "ATM") { screen.SendControlKey(ControlKeyCode.Transmit); } if (screenID2 == "LOGON") { screen.SendKeys("kayak"); screen.SendControlKey(ControlKeyCode.Transmit); } } static void Main(string[] args) { //Start a visible instance of Reflection or get the instance running at the given channel name Application app = MyReflection.CreateApplication("myWorkspace", true); //Create and configure a terminal for an Ibm 3270 session and connect IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(new Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}")); terminal.HostAddress = "demo:ibm3270.sim"; terminal.Port = 623; terminal.Connect(); //Make the session visible IFrame frame = (IFrame)app.GetObject("Frame"); frame.CreateView(terminal); //Create an event handler for the NewScreenReady event IIbmScreen screen = terminal.Screen; screen.NewScreenReady += screen_NewScreenReady; Console.ReadKey(); } } } |
After sending data to a host, using VT or other non-block mode emulation, you must pause execution until you determine when the host has finished with its reply.
Navigate a session |
Copy Code
|
---|---|
//For any terminal screen, you can use the following methods to navigate IScreen screen = terminal.Screen; //Wait for the host before entering commands screen.Wait(3000); screen.SendKeys("demodata"); screen.SendControlKey(ControlKeyCode.Enter); //Wait for the host before entering additional commands screen.Wait(3000); //additional commands... |
You can use Reflection Search functions to find locations on the screen that you want to use as a starting point for a selection.