WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

URLs - Web - Browser Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Grabbing data from a www Java/activeX window

Keywords:   Grabbing data Java/activeX window

Question:

I have a requirement to read columnized data from an internet based java applet window (I think its java). Ideally I want winbatch to wait for any change in data in the window and then grab it without interfering with normal mouse keyboard operation - ie I want winbatch to be event driven.

I am using IE5 as an internet browser.

Is there a way I can do this in winbatch?

Answer:

It depends on the implementation of Java. Apparently the IE java does not use anything that resembles windows controls for its buttons and the entire Java screen is pretty much invisible to WinBatch. The netscape implementation, on the other hand, is much friendlier.

IIRC, there is a Java class somewhere that can be used in Java applications that allows them to be controled by *other* Java applications. However, this does not benefit WinBatch and there's no good way to directly interface a WinBatch script to a Java applet.

The main problem here is that there are several Java Virtual Machine [JVM] implementations that are implemented on Windows [all of the 32-bit Windows platforms]. One of them is Microsoft's own JVM that is used by IE. Another is Netscape's JVM that runs as part of the Netscape web browser [actually 2 JVMs from what I understand, with Netscape 4.x & 6.x using different versions/implementations]. There are others, too, but those are the big ones. The key thing to remember about a JVM is that it is considered mainly to be opaque w/respect to a Java applet being able to "see" the details of the host environment on which the JVM in which it runs is being executed. One of the side effects is that in general, the JVM is also opaque w/respect to other programs in the host environment being able to interface with it. The JVM does not generally present itself as a OLE server [via a COM interface]; nor does it usually present itself as a regular Windows application using regular window controls [e.g. edit boxes, list boxes, tree views, check boxes, radio buttons, tabbed panels, etc...]. This means that attempting to directly manipulate a Java applet with the Control Manager extender is 100% out of the question. From the point of view of a regular Windows application, the Java applet simply presents a window containing a graphical bitmap; the content of that bitmap is generated by the JVM and is not drawn as individual controls by the Windows GDI. At best, you can set focus to the applet's main window that appears on your desktop and then you can send keystrokes to it to manipulate it. This method is fraught with perils [critical timing of keystrokes, control TAB order changing in different applet versions or on different JVMs, etc...].

Some JVMs sort of break the opaqueness by allowing a Java applet to call down to a native library on the host system on which the JVM is being executed. In the case of Microsoft's JVM, this means that you can directly call functions in a DLL. However, this does not change the fact that the application window presented by the JVM is still just an opaque bitmap.

I've heard that some screen reader applications can take the bitmap of any window and interpret it into a set of controls through some very sophisticated programming. At that point you could probably at least capture text and have some idea where to place the mouse pointer in order to perform simple button click & double click operations within the window. Still, this method may be very prone to errors at run time depending on variations in your computing environment.

Note: For ways of automating Java apps, be sure to check out

Accessbridge from SUN
http://java.sun.com/products/accessbridge/

Article ID:   W15342
File Created: 2003:08:15:14:17:20
Last Updated: 2003:08:15:14:17:20