|
Mochasoft has a java api for its java based emulator that allows one to screen
scrape. I have a few *limited* instances where screen scraping would be an
enormous benefit. This program is really inexpensive and the API looked easy
so I tried it out.
I was quickly able to get the sign on screen and effectively sign on and get to
the next screen. No problem.
But what I can't seem to do is to get the buffer for any screen after the
intial screen. Repeated calls to do_read_all() even after a do_wait_input(100)
get the original buffer data for the sign on screen.
I tried longer waits, changing byte variables, NULLing out the buffer array
before the next calls and get the same results. Since I can watch the session
in a separate window I know I am moving to new screens on the 400. It just
isn't reflected in the do_read_all().
Has anyone used this API? I was hoping that perhaps someone may have a simple
example of a multi-screen screen scrape that works.
A very simple sample of my test program is shown below for those that want to
look.
Thanks,
Larry
public class Test2 {
public static void main(String[] args)
{
byte buf[][]; // screen
byte ttt[]={72,72,71,71,71,71,71,72,72}; // very simple
password hiding
String sss = new String(ttt); // save
password as string for later use
api_tn5250 a = new api_tn5250();
a.do_load_config("tn5250.cfg");
a.use_display(false,true); // hidden,standalone
if (a.do_connect("mySystem",23) == true) {
a.do_wait_input(0);
buf = a.do_read_all();
a.do_goto_field(1);
a.do_write_text("LARRY"); //userid
a.do_goto(18,6);
a.do_write_text(sss); //password
a.do_aid_key(0xf1); //enter key
a.do_wait_input(0);
buf = a.do_read_all();
//Print out first line of screen for
identification
int x=1;
for (int y=0;y<buf[x].length;y++){
System.out.println(x+": "+buf[x][y]+"
: "+(char)(buf[x][y]));
}
System.out.println("");
a.do_disconnect();
System.out.println("\nDisconnected");
}
System.exit(0);
}
}
_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way your home on the Web - http://www.myway.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.