Can you check if a site requires a login and if so, close IE?

  • Thread starter Thread starter CK
  • Start date Start date
C

CK

I have this code. Is there anyway to determine is a site requires a login
and if so, do not display that page? Close the browser? Otherwise I have to
click cancel. Is this possible? Sorry for the cross post. I wasn't sure
where this belonged.
Thanks in advance,
~ck

'********** Example Code ************

OpenWebSites
WScript.echo "Done"
WScript.quit


Sub OpenWebSites
Dim objHTML
Dim sUrls
Dim sBody
Const DELIMITER = ","

sUrls =
Split("https://mail02.innovasi.com/exchange,http://www.google.com",DELIMITER)
Set objHTML = CreateObject("InternetExplorer.Application")
For j = 0 To UBound(sUrls)
objHTML.Visible = True
objHTML.Navigate(sUrls(j))

while objHTML.ReadyState <> 4
WScript.sleep 50
wend

sBody = objHTML.Document.body.innerText
WScript.echo sBody
Next


End Sub

'********* End Code ************
 
Hi,
There are a number of ways to do this, but no magic bullet that recognizes
the things you want to skip. It looks like your code displays the web page
and then puts the text of the body of the HTML into a string variable. Why
not put the the body's innerHtml into a string variable and look at it to
see what the password code (or the invalid logon screen) looks like. Then,
change your code to go on to the next URL whenever similar code shows up in
a page.

If you are not familiar with HTML, it might be a little difficult to figure
out. For learning purposes, you might download and run a freebee HTMLEditor
download from Microsoft. Learn about this simple HTML editor at:
http://msdn2.microsoft.com/en-us/library/ms537834.aspx;

Download it at:
http://msdn.microsoft.com/archive/d...s/internet/author/html/htmleditor/default.asp

To use it, go to one of the password-requiring URLs, select some part of the
screen that indicates you want to skip it, and paste it into the
HTML_Editor.hta window. Use its File menu to save it to a file. View that
saved file in a text/html/script editor, and you should have just a small
amount of HTML code to figure out.

-Paul Randall
 
Back
Top