我正在尝试使用HACL Java库类自动化IBM PComm应用程序。 我已成功建立与pcom会话的连接以及设置/获取光标位置并从应用程序屏幕上的当前光标位置提取文本。但是无法在屏幕上的所需光标位置放置/发送文本。请帮助解决此问题。请在屏幕上找到建立连接和获取文本的代码,如下所示:
import java.util.Properties;
import com.ibm.eNetwork.ECL.ECLConnMgr;
import com.ibm.eNetwork.ECL.ECLConnection;
import com.ibm.eNetwork.ECL.ECLErr;
import com.ibm.eNetwork.ECL.ECLField;
import com.ibm.eNetwork.ECL.ECLFieldList;
import com.ibm.eNetwork.ECL.ECLPS;
import com.ibm.eNetwork.ECL.ECLSession;
import org.ohio.iOhioScreen;
public class Pcom {
public static void main(String[] args) throws ECLErr {
try{
System.loadLibrary("pcseclj");
Properties prop = new Properties();
// prop.put("SESSION_VT_LOCAL_ECHO ", "true");
prop.put("SESSION_HOST", "C:\\Mainframe\\A.ws"); // works OK
prop.put("SESSION_WIN_STATE", "MAX");
prop.put("SESSION_VT_KEYPAD ", "SESSION_VT_KEYPAD_APPL");
prop.put("SESSION_VT_LOCAL_ECHO", "SESSION_VT_LOCAL_ECHO_ON");
ECLSession session = new ECLSession(prop);
session.StartCommunication(); //works OK
Thread.sleep(5000);
session.connect(); //works OK
ECLFieldList fieldList = session.GetPS().GetFieldList();
session.GetPS().SetCursorPos(18, 044); //works OK
/session.GetPS().SetString("some_text"); // does not work
for(int i=0;i<fieldList.size();i++){ //works OK
//System.out.println("field ======================= "+fieldList.GetFirstField(i).getAttribute());
ECLPS ps=session.GetPS();
System.out.println(session.GetName()); //works Ok
session.GetPS().SetCursorPos(17, 44); //works OK
session.GetPS().SendKeys("some_text",17,44); // does not work ,17,44 are co ordinate positions pn screen
System.out.println(session.GetConnType()); // works ok
ps.SendKeys("some_text"); //does not work
/* ------------ does not work-------------
fieldList.FindField(17, 44).SetText("some_text");
fieldList.FindField(17, 44).SetString("some_text");
fieldList.FindField(18, 44).setString("some_text");
*/
System.out.println(fieldList.FindField(17, 44).GetLength()); // works ok
System.out.println(fieldList.FindField(17, 28).getString()); //works ok
}
catch(Exception e)
{
System.out.println(e);
}
}
}