• Post Reply Bookmark Topic Watch Topic
  • New Topic

Screen Scraper

 
Mike Cunningham
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know where I can find an example of some screen scraping code? I will be pulling out values from an emulator...and attempting to execute emulator screens from the program.
Any help or direction would be much appreciated.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that a 3270 emulator? Did you get any samples with your emulator product? Back in the 80s IBM promoted an API called HLLAPI that many emulator products implemented. Lately I've seen the vendors being more independent so it's hard to say exactly what kind of methods you'll be calling on the emulator.
In short, the logic is
* read something off the screen to see where we are
* send some keystrokes to navigate somewhere
* wait for the session to settle - sometimes tricky to determine
* repeat
For reading off the screen, the scraping part, the API is usually by row and column position. Again back in the 80s I had a REXX routine for the IBM OS/2 emulator that would examine a screen and report the row, column, length and type of every field. That info was handy when writing scraping routines. You might see if there are APIs that would let you write such a tool.
Sending keystrokes has some traps. Some fields will auto-skip to the next when typed full, others will not. So some times you have to be sure to pad values to the full length, other times you have to be sure to tab to the next field. Worst case: send Home and the right number of tabs before every field you "type" in.
Waiting for the session to settle is also inconsistent. I think we gave up depending on any of the flags in the emulator and wait for some time. Some mainframe systems can send a screen in mulitple chunks, so there are multiple "screen finished" events. Kinda nasty.
Any of that useful?
 
Van Glass
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out version 5.2 of iNet Factory. This includes a set of classes in the com.jscape.inet.telnet and com.jscape.inet.terminal packages that may meet your needs. The terminal package contains emulation support for VT100 although is extensible for other emulation types.
See the following article for an example of how to use the telnet classes included:
http://www.jscape.com/articles/scripting_telnet_sessions_using_java.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!