我知道很多次都会问这个问题。但我没有得到我想要的东西。 我需要自动化quick3270,它用于使用java连接到大型机。 首先让我告诉你我想要什么。 我需要我的代码打开quick3270.exe然后打开我保存的会话:---这已经完成。 现在,我必须向quick3270发送命令。这就出现了问题,我不知道如何向该软件发送命令。 第三是我正在使用机器人类。所以我可以输入:TAB,ENTER,F3等输入。
所以,整件事我想将命令发送到quick3270。我也需要间隔。就像发送一个命令然后延迟1秒然后等等。
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();
}
}
答案 0 :(得分:1)
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
希望有帮助...