Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding this or that word in a webpage

Status
Not open for further replies.

Mingas

Programmer
Jul 10, 2013
15
ZA
thread329-1700446

Hi guys...suppose you have two word to search for, how would you then do it. That is: If Matches = word1 or word2 then...
 
So, what is your actual code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Find "Invalid","

Function Find(StrString,URL)
Titre = "Find a String in a webpage"
'URL = "Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate(URL)
ie.Visible = 1
DO WHILE ie.busy
wscript.sleep 100
LOOP

wscript.sleep 1000
Set WshShell = WScript.CreateObject("WScript.Shell")
'WshShell.AppActivate"Browser Logon"
ie.Navigate(URL)
wscript.sleep 1000
With ie.Document

.getElementByID("userName").value = "h"
.getElementByID("password").value = "h"



End With
wscript.sleep 1000

Set oInputs = ie.document.getElementsByTagName("input")

For Each elm In oInputs
If elm.Value = "Logon" Then
elm.Click
Exit For
End If
Next





wscript.sleep 5000
Data = ie.document.documentElement.innertext
Set ie = Nothing
Set objRegex = new RegExp
objRegex.Pattern = StrString
objRegex.Global = False
objRegex.IgnoreCase = True
Set Matches = objRegex.Execute(Data)
For Each Match in Matches
'MsgBox "We found this word : " &vbCr& qq(Match.Value) & "in " & URL,64,Titre
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "my email"
.Subject = "Found invalid"
.ReadReceiptRequested = False
.HTMLBody = ""
End With
MyItem.Send


Next
End Function

Function qq(strIn)
qq = Chr(34) & strIn & Chr(34)
End Function

Function Pause(NbMin)
wscript.sleep NbMin*1000*60
End Function
 
But this only searches for string "invalid".... are would also like is to seach for string "access" as well
 
Hell I'm so frustrated even my typing is out the window, I'm closer to deadline and cannot seem to figure this out. I had taken it for granted and left it for last minute.
 
PHV....you such a life saver...thanks a mil, much appreciated :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top