Maximus1 Posted June 24, 2010 Share Posted June 24, 2010 hi, i`m trying to write an app to load the pics on the result page from google pics, but don`t know how to do this.i`m new to autoit and have only little experience in programming.let me first explain what my app should do.i use the windows media center and the addin mediabrowser. mediabrowser can display actorimages but imdb and tvdb do not have all pictures available.so i decided to wirte my app to get nearly all actors with pics of them. it reads a list of actors and asks google for pictures matchin the acors name.the IE windows opens... and the resultspage is shown... OKbut what now and how can i run it without an IE window that opens every time. atm. i have over 4000 actor in the list. 4000 windows will kill my PC.here is my code... it`s not much.#include <IE.au3> $file = FileOpen("noimage.txt",0) ;liste in file wird geöffnet While 1 $line = FileReadLine($file) ;gelesene zeile ist variable If @error = -1 Then ExitLoop ;wenn EOF dann ende DirCreate("G:\Filmliste\test\" & $line) ;ordner mit zeilenname erstellen $oIE = _IECreate ("http://www.google.de/imghp?hl=de&tab=wi") ;ie instanz mit definierter webseite öffnen $oForm = _IEFormGetObjByName ($oIE, "f") $oQuery = _IEFormElementGetObjByName ($oForm, "q") _IEFormElementSetValue ($oQuery, ""& $line) ; $line ins suchfeld eingeben _IEFormSubmit ($oForm) ;such das MsgBox(0, "Line read:", $line) ;ausgabe des namens in messagebox damit es kein killer bot wird :-) Wend FileClose($file) ;file schliessenthe noimage.txt:Barbara O'Neil Kenneth Tobey Raymond Greenleaf Griff Barnett Tom Vaughan Nectar Rose Babak Tafti Bronwen Hughes Tyra Ferrell Maya Angelou Che J. Avery Lloyd Avery II Maia Campbell Michael Colyar Kina Cosper Dina D. James Deeth ... ... ...summary:doneread lines of noimage.txtcreate folder with content of the linepost on google and get resulstnot donedownload pics to the folderrun without IE windowhow do i do this????any hints?thanks Link to comment Share on other sites More sharing options...
Maximus1 Posted June 24, 2010 Author Share Posted June 24, 2010 no edit button here? ok the IE windows closes now. i added _IEQuit ($oIE) to my script Link to comment Share on other sites More sharing options...
BrettF Posted June 27, 2010 Share Posted June 27, 2010 Welcome to the forums Maximus1. This doesn't look to be too hard. I have created a sample script that will create an array of all images on a google search page. expandcollapse popup#include <IE.au3> #include <Array.au3> Global $aOut[1][2] $count = 0 $sTerm = "apple+cake" ;URL Friendly. I.E spaces become + etc. $sURL = "http://images.google.com/images?q=" & $sTerm ; Make the URL ;Open the IE $oIE = _IECreate ($sURL, 0, 0, 1, 0) ;Get all images on the page $oImgs = _IEImgGetCollection ($oIE) ;Get Number of images $iNumImg = @extended ;Resize the array ReDim $aOut[$iNumImg][2] ;Loop through the collection of images For $oImg In $oImgs ;Check if image is a thumbnail (gstatic.com" If StringInStr ($oImg.src, "gstatic") Then ;get the source URL $string = StringSplit ($oImg.src, ":http", 1) ;Yes, count += 1 $count +=1 $aOut[$count][0] = $oImg.src $aOut[$count][1] = "http" & $string[2] EndIf Next ;Set the [0][0] element to be the number of images $aOut[0][0] = $count ;Resize to only have the images we need ReDim $aOut[$count+1][2] ;Display _ArrayDisplay ($aOut) From there you should be able to work out how to download an image. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
piratao2 Posted March 12, 2012 Share Posted March 12, 2012 It looks like the script suggested does not work on the current Google Image search web site. The array returned is empty. Looking at the source code of the search results page on google image search web site, I did not find the URL for each image. It looks like they are in a DIV now. Could anybody please help with that? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now