Showing posts with label Create Script to get the list of links in Google and do spell check. Show all posts
Showing posts with label Create Script to get the list of links in Google and do spell check. Show all posts
Wednesday, December 15, 2010

Word Object

Word Object

1) Create a word document and write some data

dim mw
set mw=CreateObject("Word.Application")
mw.Documents.Add
mw.selection.typetext "hello"
mw.ActiveDocument.SaveAs "e:\QTPInside.doc"
mw.quit
set mw=nothing


2) Create 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

3) Script to display all the doc files in all the drives in the system


Dim mw
Set mw=CreateObject("Word.Application")
Set fs=createobject("Scripting.FileSystemObject")
Set d=fs.Drives
mw.FileSearch.FileName="*.doc"
For each dr in d
msgbox dr
mw.FileSearch.LookIn=dr
mw.FileSearch.SearchSubFolders=True
mw.FileSearch.Execute
For each i in mw.FileSearch.FoundFiles
print i
Set f=fs.GetFile(i)
print f.Name&" "&f.Size&" "&f.DateCreated
print "-------------------------------------------------------------------"
Next
Next
mw.Quit