Jump to content

How can I do a parallel search with interenet explorer?


bhodi78
 Share

Recommended Posts

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?

#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

Link to comment
Share on other sites

... 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]

Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...