Pages

Custom Search

Web Scripts-II

Web Scripts-II

1) Script to get the list of links in Google and do spell check
=====================================
Dim d
set mw=CreateObject("Word.Application")
set d=Description.Create
d("micclass").value="Link"
set a=Browser("Google").page("Google").childobjects(d)
for i=0 to a.count-1 
mw.WordBasic.filenew 
s=a(i).getROProperty("innertext")
mw.WordBasic.insert s 
if mw.ActiveDocument.Spellingerrors.count>0 then 
Reporter.ReportEvent 1,"Spelling","spelling error :"&s 
end if
mw.ActiveDocument.Close(False)
next
mw.quit
set mw=nothing

2) Script to check ON the checkboxes in yahoo mail inbox
========================================

Dim d
Set d=Description.Create
d("micclass").value="WebCheckBox"
Set c=Browser("Inbox (17) - Yahoo! Mail").Page("Inbox (17) - Yahoo! Mail").ChildObjects(d)
For i=1 to 10
c(i).set "ON"
Next

3) script to select a mail having subject 'hi' or 'HI'
=================================
n=Browser("yahoo").Page("yahoo").WebTable("Inbox").RowCount
For i=2 to n
s=Browser("yahoo").Page("yahoo").WebTable("Inbox").GetCellData(i,7)
If lcase(trim(s))="hi" Then
Browser("yahoo").Page("yahoo").WebCheckBox("index:="&i-1).set "ON"
End If
Next
4) Function to send a mail
====================
Function SendMail(SendTo, Subject, Body, Attachment) 
Set otl=CreateObject("Outlook.Application")
Set m=otl.CreateItem(0) 
m.to=SendTo 
m.Subject=Subject 
m.Body=Body 
If (Attachment <> "") Then 
Mail.Attachments.Add(Attachment)
End If
m.Send 
otl.Quit 
Set m = Nothing 
Set otl = Nothing
End Function
Call SendMail("nagesh.rao46@gmail.com","hi","This is test mail for tsting","")
Adv VBScripts

5) Open Internet Explorer and navigate to yahoo mail
===================================
Dim ie
Set ie=CreateObject("InternetExplorer.Application")
ie.Visible=True
ie.Navigate "www.yahoomail.com"
x=Browser("CreationTime:=0").GetROProperty("title")
msgbox x

6) Function for Counting Objects from any opened web page

Function Objects_Count(myObject)
   Dim Objects
   Set Objects=Description.Create
 Objects("micclass").value=myObject
 Set Object=Browser("title:=.*").Page("title:=.*").ChildObjects(Objects)
 TotObjects=Object.Count
 Msgbox TotObjects
End Function
Call Objects_Count("WebButton")

No comments: