Sign in to follow this  
Followers 0
bhodi78

How can I do a parallel search with interenet explorer?

5 posts in this topic

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks to everyone for the answers, I think I will use both the solutions.

:)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0