SOLVED! Re: Alright... A VB.net challenge?

  • From: "Bryan Garaventa" <bryan@xxxxxxxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 4 Oct 2007 01:52:37 -0700

YES! ALRIGHT! YEEE HAUUH! I did it! I'ts alive by God!

Not that I'm happy about this for any reason...

So want to know the solution?

To create an ActiveX that is globally accepted within a JAWS script, and can extract the exact source code (including the DocType and anything else outside of the HTML tag),just do the following...

In VB6, create an ActiveX Dll project.

Import Edanmo's OLE interfaces & functions type library (OleLib.tlb) as a reference.

Then add the following Function to your code file...

Public Function SaveSourceCode(ByVal Doc As HTMLDocument, _
ByVal FPath As String) As Boolean
Dim Stream As IPersistFile
Set Stream = Doc
Stream.Save FPath, False
SaveSourceCode = True
End Function

That's all! Pretty exciting ey?

To reference it from a jaws script, just do something like...


var object CurrentDoc,

object Parser,

string FilePathToSaveTo,

int Result



let Result = false



let FilePathToSaveTo = "C:\\UltraModuleMaker\\Test.htm" ; Make the file path whatever...



let CurrentDoc = IEGetCurrentDocument () ; Any valid document object will due...



let Parser = CreateObjectEx ("DementedGofer.CBangBangDuck", true) ; Well, I liked my class names anyway...

Pause ()

if not Parser then

Say ("damn", 0)

Return

endif



let Result = Parser.SaveSourceCode(CurrentDoc, FilePathToSaveTo)

if not Result then

Say ("Double damn!", 0)

endif

let Parser = Null ()




----- Original Message ----- From: "Bryan Garaventa" <bryan@xxxxxxxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, October 03, 2007 9:52 AM
Subject: Alright... A VB.net challenge?


OK, it doesn't look like I'm having any luck extracting the string for a
full Document object of a web page where everything is included. So, what
about this?

Is it possible, using VB.net,
1. to briefly instantiate an IE or WebBrowser object,
2. Then open a file on the local hard drive, such as Test.htm using the new
object,
3. Somehow place the document object of another page into the currently open
one, such as: TempWebBrowserObject.Document =
CurrentIEWebBrowserObject.Document
4. Then close Test.htm, and have the new content saved with the file when
closed?

Any ideas whether this can be done?

Trying to find a solution, I converted the code at
http://www.thescripts.com/forum/thread348964.html
into VB.net 2005.

For the life of me though, I can't get the damned thing to work, though it
looks like it should.

If you'd like to take a look at the project file, including the compiled
dll, (I would appreciate your feedback). I've uploaded it to
http://gutterstar.net/cgi-bin/apps/HTMLParser.zip

Any ideas would be much appreciated.

Best wishes,

Bryan

__________
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:

  • » SOLVED! Re: Alright... A VB.net challenge?