Hello, RS Jandu!
You proposed a nice task! :)
I used descriptive programming to get all found results.
This is a key code of my script:
Set oDescrLink = Description.Create
() oDescrLink("html tag").Value = "a" oDescrLink("class").Value = "l"
' get all found results
Set arrLinks = Browser("Google").Page("Google").ChildObjects(oDescrLink) nLinks =
arrLinks.Count For i = 0 to nLinks - 1
' Download results from the current link - arrLinks(i) ......
NextThis part of the code gets all link from the current page. You can download every file from the current link.
After that, you have to repeat the iteration -
i.e. download all files from the next page (next ten results)...
I hope, my explanations will help you! :)
Also, I'm sending the full source of my Google Dowloader :)
Sub PerformSearch(sQuery) ' search for all ppt-files Browser("Google").Page("Google").WebEdit("q").Set sQuery
Browser("Google").Page("Google").WebButton("Google Search").Click
End SubSub SaveResultsFromPage()
Set oDescrLink = Description.Create() oDescrLink("html tag").Value = "a"
oDescrLink("class").Value = "l" ' get all found results
Set arrLinks = Browser("Google").Page("Google").ChildObjects(oDescrLink)
nLinks = arrLinks.Count For i = 0 to nLinks - 1
'MsgBox arrLinks(i).ToString() ' save the current result
arrLinks(i).Click 'Browser("Google").Page("Google").Sync
' Process "File Download" dlg
' TODO: add additional verification for the case when file with the current name exists in the folder "Desktop" Dialog("File Download").Dialog("SaveAs").WinToolbar("ToolbarWindow32").Press "Desktop"
Dialog("File Download").Dialog("Save As").WinButton("Save").Click
Dialog("Download complete").WinButton("Close").Click
Next
End SubPerformSearch "filetype:ppt"
' go through all the results pagesDo
SaveResultsFromPage() If Browser("Google").Page("Google").Link("Next").Exist Then
Browser("Google").Page("Google").Link("Next").Click
Else Exit Do End If
LoopAny questions - welcome! :)
--
Dmitry Motevich,
I'm looking for online/remote job - $0.01/hour
No joking!