bhodi78 Posted September 30, 2009 Posted September 30, 2009 Hello everyone, this following is a simple script that for each word, do a search on google and save the result as a file. I would like to run this search in parallel by opening several tabs of IE. How can I do? expandcollapse popup#include <IE.au3> $List="Intel Nvidia TV Android Computer" $tmp = StringSplit($List," ",2) ;Create an Internet Explorer Browser window. $oIE = _IECreate () For $f In $tmp ;Opens a text file for reading or writing. $file = FileOpen("Result of ("& $f &").txt", 1) ;Directs an existing browser window to navigate to the specified URL _IENavigate ($oIE,"http://www.google.com") ;Wait for a browser page load to complete before returning _IELoadWait ($oIE) ;Returns a collection object variable representing the Forms in the document or a single form by index. $oForm = _IEFormGetCollection ($oIE, 0) ;Returns a collection object variable representing all Form Elements within a given Form. $oQuery = _IEFormElementGetCollection ($oForm, 2) ;Set the value of a specified Form Element. _IEFormElementSetValue ($oQuery,$f) ;Submit a specified Form _IEFormSubmit ($oForm) ;;Wait for a browser page load to complete before returning _IELoadWait ($oIE) ;Returns an object variable by id or name. $oDivBody = _IEGetObjById($oIE,"res") ;Append a line of text to the end of a previously opened text file. FileWriteLine($file,$oDivBody.innerText) ;Closes a previously opened text file. FileClose($file) Next ;Close the browser and remove the object reference to it. _IEQuit ($oIE) Exit Thank you all bye
herewasplato Posted October 1, 2009 Posted October 1, 2009 ... search in parallel by opening several tabs of IE. How can I do? ...I have no idea. I know very little about the IE UDFs, but I shortened your loop by feeding your search term to the URL. I also added 100 returns... you can reduce that as desired. #include <IE.au3> $List = "Intel Nvidia TV Android Computer" $tmp = StringSplit($List, " ", 2) ;Create an Internet Explorer Browser window. $oIE = _IECreate() For $f In $tmp ;Opens a text file for reading or writing. $file = FileOpen("Result of (" & $f & ").txt", 1) ;Directs an existing browser window to navigate to the specified URL _IENavigate($oIE, "http://www.google.com/search?num=100&q=" & $f) ;Wait for a browser page load to complete before returning _IELoadWait($oIE) ;Returns an object variable by id or name. $oDivBody = _IEGetObjById($oIE, "res") ;Append a line of text to the end of a previously opened text file. FileWriteLine($file, $oDivBody.innerText) ;Closes a previously opened text file. FileClose($file) Next ;Close the browser and remove the object reference to it. _IEQuit($oIE) Exit [size="1"][font="Arial"].[u].[/u][/font][/size]
Juvigy Posted October 1, 2009 Posted October 1, 2009 Check out this example: $oIE=_IECreate("www.google.com") $oIE.navigate2("www.dir.bg",2048) How are you going to switch between the tabs is the tricky one.Search the forum , it has been discussed before.
jvanegmond Posted October 1, 2009 Posted October 1, 2009 You can run several scripts at once. Each once searching for one word (accept word via command line: $CmdLine). You also create a master script that runs the individual scripts that search. The master script reads the list of words. github.com/jvanegmond
bhodi78 Posted October 9, 2009 Author Posted October 9, 2009 Thanks to everyone for the answers, I think I will use both the solutions.
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