Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading "View Source" of an HTML page using VBScript....

668 views
Skip to first unread message

Matt Rosenburg

unread,
Aug 4, 2005, 5:18:06 PM8/4/05
to
To all,

I'm looking for a way, via a VBScript, to read the contents of an .HTML
page. Basically, I'm looking for the programatic equivalent of "View Source"
in IE.

I have a VB Script that launches IE in "Kiosk" mode when my users log in,
and when they navigate to a page that contains a certain text phrase, I want
IE to close. I have the logic built in to close IE, but I can only get it to
work based on the URL that the users' browser is currently pointing at. I
can't parse out the text of the HTML file that they're viewing.

Does anyone have any suggestions?

Regards,

Matt Rosenburg

McKirahan

unread,
Aug 4, 2005, 7:00:54 PM8/4/05
to
"Matt Rosenburg" <MattRo...@discussions.microsoft.com> wrote in message
news:294AC8EE-9023-4791...@microsoft.com...

I don't fully understand what you're trying to do.

The code below (watch for word-wrap) does the following:

1) Opens a Web page in kiosk (fullscreen) mode
2) Retrieves and displays the URL of the page
(even though it's already known via "cURL")

Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "kiosk.vbs"
Const cURL = "http://www.google.com/"
'*
'* Open URL
'*
Dim objIEA
Set objIEA = CreateObject("InternetExplorer.Application")
objIEA.Navigate cURL
objIEA.FullScreen = True
objIEA.Visible = True
While objIEA.Busy
Wend
'*
'* Show URL
'*
Dim objIED
Set objIED = objIEA.document
WScript.Echo objIED.Location
'*
'* Destroy Objects
'*
Set objIED = Nothing
Set objIEA = Nothing

You can use XMLHTTP to retrieve the source of the page and parse it.

But you want to retrieve the source of each page that the user goes to...?


mr_unreliable

unread,
Aug 5, 2005, 11:55:07 AM8/5/05
to
Matt, depending on exactly what you want to do, there are several ways
to communicate with your "page-of-choice".

If you have access to the html source, one crude/simple way is to add
a "hidden" element to the page in question.

Then, have your script detect onload events, and when the page is loaded:

If (document.getElementById("hiddenElement").Value = "quit") then...

Another (more sophisticated) method is to set some event handler on
the page in question to call a subroutine in your script:

Set document.getElementById("pageButton").onClick = GetRef("mySub")

You could then click the button yourself (using the Click method).

As you know, a page can't close itself, your script must do that.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

0 new messages