Can anyone point me in the direction of information on how to control
Internet Explorer from Java?
From Java, I want to tell Internet Explorer to load a page from a given Url
(this I can already do) and then have my Java Program read the HTML that is
being displayed by Internet Explorer.
Is there some DDE interface or some other way I can issue commands and get
results back from
Internet Explorer?
Thanks,
Andrew Thompson - 26 Jun 2005 01:59 GMT
> Can anyone point me in the direction of information on how to control
> Internet Explorer from Java?
Javascript - LiveConnect - Applet - Socket.
JS communicates via LiveConnect with the (signed) Applet,
which then communicates with the application via socket.
( This route has a large learning curve. )

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Andrew Thompson - 26 Jun 2005 03:20 GMT
> Can anyone point me in the direction of information on how to control
> Internet Explorer ..
As an aside. That is a bit tricky - if the end user
browses the net using Safari..

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Roedy Green - 26 Jun 2005 08:37 GMT
>Can anyone point me in the direction of information on how to control
>Internet Explorer from Java?
>
>From Java, I want to tell Internet Explorer to load a page from a given Url
>(this I can already do) and then have my Java Program read the HTML that is
>being displayed by Internet Explorer.
Perhaps what would be much easier is to get IE out the picture, and
just pretend to be a browser yourself and send off a CGI get,
retrieving the HTML. Then extract what you want from it using a
parser.
See http://mindprod.com/jgloss/parser.html
http://mindprod.com/jgloss/cgi.html
If you actually want to see the bits that IE renders, look at the
Robots class. (sp?) to do a screen snapshot.

Signature
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
Paul Battersby - 26 Jun 2005 20:48 GMT
The problem I'm having is that I want to automatically download some HTML
from a web site but the remote server seems to deny my request when it comes
from a Java program but allows me to see the data when I access the web site
with Internet Explorer. My program works fine with other web sites, just not
this one in particular.
Any ideas?
Roland - 26 Jun 2005 23:04 GMT
> The problem I'm having is that I want to automatically download some HTML
> from a web site but the remote server seems to deny my request when it comes
[quoted text clipped - 3 lines]
>
> Any ideas?
Probably that website checks the "User-Agent" header of the HTTP request.
You could try to set the property "http.agent" to a value that matches
Internet Explorer or another well known browser. Java uses the value of
this property when it sends a HTTP request (i.e. probably when using a
HTTPURLConnection). See
<http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html>
You can specify the value of "http.agent" either at the commandline, like
java "-Dhttp.agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
your.app.Main
or in your program:
// IE6/W2K
System.setProperty("http.agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
// Moz 1.7.8/W2K
System.setProperty("http.agent",
"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8)
Gecko/20050511");

Signature
Regards,
Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
Wibble - 27 Jun 2005 00:32 GMT
>> The problem I'm having is that I want to automatically download some HTML
>> from a web site but the remote server seems to deny my request when it
[quoted text clipped - 29 lines]
> "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8)
> Gecko/20050511");
The site may have activeX controls that java will never understand.
Jacob is a Java/Com interface that will let you control explorer. It
should do what you want.
http://sourceforge.net/projects/jacob-project/