Design a site like this with WordPress.com
Get started

Functions to work on the web with vbscript

I will be sharing a research of functions you could use in vbscript for online web
access.

‘LIBRARIES OF FUNCTIONS

Function Searchweb(url,mystring)
gsearch = url & “#q=” & mystring
Set IE = CreateObject(“InternetExplorer.Application”)
set WshShell = WScript.CreateObject(“WScript.Shell”)
IE.Navigate gsearch
IE.Visible = True
Wscript.Sleep 6000
‘IE.Document.All.Item(“lst-ib”).Value = mystring
‘IE.Document.All.Item(pass).Value = valuep
WshShell.AppActivate “IE”
‘IE.Document.getElementById(submit).Click
‘IE.Document.getElementById(submit).Click
‘WshShell.SendKeys “{ENTER}”
‘return gsearch
End Function

Function Loginweb(url,user,valueu,pass,valuep,submit)
Set IE = CreateObject(“InternetExplorer.Application”)
set WshShell = WScript.CreateObject(“WScript.Shell”)
IE.Navigate url
IE.Visible = True
Wscript.Sleep 6000
IE.Document.All.Item(user).Value = valueu
IE.Document.All.Item(pass).Value = valuep
WshShell.AppActivate “IE”
IE.Document.getElementById(submit).Click
‘WshShell.SendKeys “{ENTER}”
End Function

Function Searchlink(url,linktext)
On error resume next
Dim WshShell, objIE, ElementCol
Dim LinkHref

LinkHref = url
‘This is the web site that will give the Certificate Security
Warning

Set WshShell = WScript.CreateObject(“WScript.Shell”)
Set objIE = CreateObject(“InternetExplorer.Application”)
objIE.Visible = False
‘No need to display IE before the “final” page has loaded (user never sees
the Certificate Warning page)
objIE.Navigate LinkHref ‘load web page
wshShell.AppActivate objIE

Do While objIE.Busy
wscript.sleep 100
Loop

Set ElementCol = objIE.Document.getElementsByTagName(“a”)
‘Get all links on web page
‘Grap/click the link we are looking for…
For Each Link In ElementCol
If Link.innerHTML = linktext Then
Link.Click
Exit For
End If
Next
objIE.Visible = True
end function

Function clickon(url,eleid)
‘Dim URL
Dim IE
Set IE = CreateObject(“internetexplorer.application”)
URL = url
IE.Visible = True
IE.Navigate URL

Do While IE.Busy
WScript.Sleep 100
Loop

IE.Document.getElementById(eleid).Click
end function

Function Find(StrString,URL)
Titre = “Find a String in a webpage”
‘URL = “https://www.facebook.com
Set ie = CreateObject(“InternetExplorer.Application”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
ie.Navigate(URL)
‘ie.Visible = 1
ie.Visible = 0
DO WHILE ie.busy
wscript.sleep 100
LOOP
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
Next
End Function

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

Function Pause(NbMin)
wscript.sleep NbMin*1000*60
End Function

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: