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
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...?
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)