1

I know this question is asked many times.But i didnt get what i want. I need to automate quick3270 which is used to connect to mainframe using java. First let me tell you what i want. I need my code to open quick3270.exe then open my saved session:---this is done. Now, I have to send commands to the quick3270.Here comes the problem, I dont know how to send command to that software. Third is I am using robot class.So that i can input:TAB,ENTER,F3 etc. inputs.

So, the whole thing is I want to send commands to quick3270. I need interval also.Like send one command then delay of 1 second then other and so on.

public static void main(String[] args) throws IOException, AWTException { 

    String exeloc = "C:\\Program Files\\Quick3270\\Quick3270.exe "; 

    // my saved session
    String directory = "C:\\Users\\c111128\\Desktop\\Project\\xyz.ecf";

    ProcessBuilder builder = new ProcessBuilder(new String[] { exeloc, directory });

    // Starting the process
    Process p = builder.start();

    // For handling keyboard events 
    Robot robot = new Robot();

    try {
        robot.delay(2000); 

        // Passing enter key to top screen
        robot.keyPress(KeyEvent.VK_ENTER);
        robot.delay(4000);            
        // Here I want to write the command
        //Command like:"teleview" which is used in mainframe



        robot.delay(1000);
    }

    catch (Exception e) {
        System.out.println("Second:" + e);
        e.printStackTrace();
    }
}
user893647
  • 11
  • 2
  • 6
  • 1
    possible duplicate of [Convert String to KeyEvents](http://stackoverflow.com/questions/1248510/convert-string-to-keyevents) – Carsten Jul 03 '14 at 11:24
  • Nope its not duplicate...I want to send keyevents(that i am able to do with robot class) and mainframe commands that i am not able to do.So, i need help with that. – user893647 Jul 03 '14 at 12:38
  • Then please describe what "mainframe commands" are, if not strings entered by the user via keyboard. – Carsten Jul 03 '14 at 13:07
  • commands like: teleview..then username id and password.I am not able to pass these commands. – user893647 Jul 03 '14 at 14:07
  • I'll rephrase my question: how do you invoke a command if you're running pro program directly, and not via your automation program? Do you use the mouse and click on an icon? Do you type the word "teleview" (followed by the parameters) with your keyboard and then press enter? – Carsten Jul 03 '14 at 14:20
  • see when i pass commands in parameter of processbuilder it gives me error.What i exactly want is to send commands to quick3270 using my java code.It means i have to code all the commands in my code.When i start the my program.It should automatically type all the commands in quick3270.So, how can i achieve that? – user893647 Jul 04 '14 at 05:11

1 Answers1

1

did you manage the Problem? Via VBA you can send commands to Quick3270 this way:

Set Session = .ActiveSession
Set Screen = Session.Screen
Screen.SendKeys ("<Enter>")
Result = Screen.WaitForKbdUnlock
Screen.SendKeys ("<PF12>")
Screen.SendKeys ("<Enter>")
Result = Screen.WaitForKbdUnlock
Screen.SendKeys ("<PF12>")
Result = Screen.WaitForKbdUnlock
Result = Screen.WaitForCursor(4, 15)
QuickPutstring "1", 10, 2

Private Function QuickPutstring(ByVal PutstringText As String, Row As Long, Col As Long)
    Screen.MoveTo Row, Col
    Screen.Putstring PutstringText
End Function

Hope that helps...

HUM
  • 11
  • 1