Re: Stumped: JAWS GetObject function for current browser window?

  • From: "Bryan Garaventa" <bryan@xxxxxxxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 25 Sep 2007 14:05:41 -0700

Thanks for taking a look. I had a similar idea, so figured I'd try to stick with what I knew. Here is what I've done.


I created a VB.net Class Lib project, and added a function for returning an object of shdocvw.WebBrowser. It takes two parameters, one is the url of the document object to find, and the other is the WebBrowser object placeholder. The function loops through all instances of shellWindows, finding each instance of shdocvw.InternetExplorer. Then it compares the vals of IEInstance.LocationURL to Url within the first parameter, and if a match is found, assigns the IEInstance to the second object parameter of shdocvw.WebBrowser. Lastly, it returns the value. Here is the class code if you would like to see the exact method.

Public Class BangBangDuck

Dim Sws As New SHDocVw.ShellWindows

Dim IE As SHDocVw.InternetExplorer

Public Function ParseIEInstances(ByVal Url As String, ByVal BrowserObject As SHDocVw.WebBrowser) As SHDocVw.WebBrowser

For Each IE In Sws

If IE.LocationURL Is Url Then

BrowserObject = IE

End If

Next

Return BrowserObject

End Function

End Class


My idea was to include this as an ActiveX com component, which I could then instantiate and use within JAWS by passing the desired parameters.

Ah but I didn't anticipate the brilliance of Microsoft! Who, in their infinite wisdom, now makes it impossible to create an ActiveX dll using their new and improved VB.net...

This is so insanely frustrating. I'm 99% sure that this method will work (unless I'm totally off), as long as I can register the dll as an ActiveX com component.

Arg, guess I'll just have to find a copy of VB6 somewhere, create an ActiveX project, import my new shiny vb.net dll, and hopefully, God willing, nothing else will go wrong.

(I'll probably feel better after lunch...)

Thanks again for the input, it really does help.

Best wishes,

Bryan

----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, September 25, 2007 1:22 PM
Subject: Re: Stumped: JAWS GetObject function for current browser window?


Thanks for that info about the IE object model.  I tried the Snapshot
object, converting the sample.vbs example to JAWS script.  For some
reason, the script does not create the image file on disk, even though
the object is instantiated.

I think the following technique would work.  Have the JAWS script run a
.vbs file with cscript.exe, passing it parameters for the URL to capture
and the file to create, and waiting for it to complete.  The URL of the
current page in IE can be obtained from a property of the document
object.

The Homer script library
http://www.EmpowermentZone.com/kitsetup.exe
includes convenience functions that could help with some of these steps,
though they can also be coded from scratch.  Let me know if you have
further questions.

Jamal
On Mon, 24 Sep 2007, Bryan Garaventa wrote:

Date: Mon, 24 Sep 2007 10:03:16 -0700
From: Bryan Garaventa <bryan@xxxxxxxxxxxxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Stumped: JAWS GetObject function for current browser window?

I thought so at first as well, but it doesn't appear to work.

What I need to do is create a JAWS script that can take screenshots of a
webpage at runtime. Unfortunately the standard Print screen method doesn't
work, because it only captures the visible area of the screen, and the
entire web page has to be captured without reloading the page from the
current IE instance.

I found an ActiveX component that claims to do this, called HTML Snapshot
( http://www.guangmingsoft.net/htmlsnapshot/help.htm ), which can apparently
take the entire image of a web page at one time. Adding to the appeal of
this method, is that the ActiveX is redistributable, which is necessary for
this project.

Specifically, the ActiveX method I would need to use within the script
appears to be SnapWebBrowser(). However, this method requires a browser
object of type IDispatch. I've tried passing the JAWS IEGetCurrentDocument
return for this argument, but with no luck. It looks like the method
requires the use of an IE instance that reveals it's ActiveX directly.

I've been doing a lot of research in this area, and made some discoveries
that may help solve the issue if possible.

First has to do with the MSDN's reference regarding Internet Explorer
Architecture ( http://msdn2.microsoft.com/en-us/library/aa741312.aspx ),
which says...

Internet Explorer Architecture

A description of each of these six components follows:

list of 6 items
. IExplore.exe is at the top level, and is the Internet Explorer executable.
It is a small application that relies on the other main components of
Internet Explorer to do the work of rendering, navigation, protocol
implementation, and so on.
. Browsui.dll provides the user interface to Internet Explorer. Often
referred to as the "chrome," this DLL includes the Internet Explorer address
bar, status bar, menus, and so on.
. Shdocvw.dll provides functionality such as navigation and history, and is
commonly referred to as the WebBrowser control . This DLL exposes ActiveX
Control interfaces, enabling you to easily host the DLL in a Microsoft
Windows application using frameworks such as Microsoft Visual Basic,
Microsoft Foundation Classes (MFC), Active Template Library (ATL), or
Microsoft .NET Windows Forms. When your application hosts the WebBrowser
control, it obtains all the functionality of Internet Explorer except for
the user interface provided by Browseui.dll. This means that you will need
to provide your own implementations of toolbars and menus.
. Mshtml.dll is at the heart of Internet Explorer and takes care of its HTML
and Cascading Style Sheets (CSS) parsing and rendering functionality.
Mshtml.dll is sometimes referred to by its code name, "Trident". Mshtml.dll exposes interfaces that enable you to host it as an active document . Other applications such as Microsoft Word, Microsoft Excel, Microsoft Visio, and
many non-Microsoft applications also expose active document interfaces so
they can be hosted by shdocvw.dll. For example, when a user browses from an HTML page to a Word document, mshtml.dll is swapped out for the DLL provided
by Word, which then renders that document type. Mshtml.dll may be called
upon to host other components depending on the HTML document's content, such
as scripting engines (for example, Microsoft JScript or Visual Basic
Scripting Edition (VBScript)), ActiveX controls, XML data, and so on.
. Urlmon.dll offers functionality for MIME handling and code download.
. WinInet.dll is the Windows Internet Protocol handler. It implements the
HTTP and File Transfer Protocol (FTP) protocols along with cache management.
list end

There's quite a bit more in depth info, but this shows the essentials.

At first, I thought, by returning the top level object, "IExplore.exe", this
would solve the problem, but not so from a JAWS script.

What I actually need to return is the current WebBrowser object, which would
require the use of Shdocvw. I believe this would do the trick.

The directions for accomplishing this, has been a bit harder to track down.
Finally though, I think I've found something that might help with this as
well, though I haven't been able to apply it directly using a JAWS script.

It is a forum entry named "FOUND! how to attach to running instances of
Internet Explorer" from dBforums. (
http://www.dbforums.com/showthread.php?threadid=867088 )

Specifically it refers to Python, but I think it may be possible to convert
the principles to a JAWS script... I hope anyway.

Please let me know if you have any insights, I'd welcome them.

Best wishes,

Bryan

----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, September 24, 2007 9:05 AM
Subject: Re: Stumped: JAWS GetObject function for current browser window?


>I must be missing something here.  Doesn't IEGetCurrentDocument return a
> COM object for the current web page in IE?  How does this not meet the
> need?
>
>
> Jamal
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: