Jump to content

Using IE.au3 to query a search engine


Recommended Posts

Hi,

I have just started using the IE.au3 udf and would appreciate some help, this looks like a very powerful tool if I can learn how to drive it.

I would like to submit a query to a search engine and then "read" the search results to browse the URL's returned by the search engine.

I have found an example of how to query the search engine:

#include <C:\Program Files\AutoIt3\beta\Include\IE.au3>

$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://au.altavista.com")

$o_SearchForm = _IEFormGetObjByName ($o_IE, "mfrm")

$o_query = _IEFormElementGetObjByName ($o_SearchForm, "q")
_IEFormElementSetValue ($o_query, "sydney plumber")
_IEFormSubmit ($o_SearchForm)

Which works fine.

I sort of understand that I need to identify and manipulate objects to achieve results. The above code returns this URL as it's result:

http://au.altavista.com/web/results?itag=ody&q=sydney+plumber&kgs=1&kls=0

Using another example that reveals the objects on a page, I supplied the above URL, and observe the following output:

Form name: mfrm
    itag    Type: hidden
    q   Type: text
    0   Type: submit
    kgs Type: radio
    kgs Type: radio
    kls Type: radio
    kls Type: radio
Form name: 0
    itag    Type: hidden
    kgs Type: hidden
    q   Type: text
    0   Type: submit

I'm afraid at this point I am stuck. I don't understand how to interpret the above results - so that I can use these "objects" to extract information from the search page results to be able to browse the URL's that were returned by the search engine.

If someone can offer some tips on how to identify and work with the relevant objects that would be great.

Thanks

VW

Link to comment
Share on other sites

Can you be more specific about what you want to do once you get the results page?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Can you be more specific about what you want to do once you get the results page?

Hi Dale,

Well the search engine returns URL's that it believes matches the search criteria. I want to be able to "read" the results returned by the search engine and open then selected URL's in IE to examine those pages.

VW

Link to comment
Share on other sites

Hi Dale,

Well the search engine returns URL's that it believes matches the search criteria. I want to be able to "read" the results returned by the search engine and open then selected URL's in IE to examine those pages.

VW

@VeeDub -- it is the words "read" and "examine" that need more explanation. You may want to take a look at _IELinkClickByText, _IELinkClickByIndex, _IELinkGetCollection, _IEBodyReadText etc.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@VeeDub -- it is the words "read" and "examine" that need more explanation. You may want to take a look at _IELinkClickByText, _IELinkClickByIndex, _IELinkGetCollection, _IEBodyReadText etc.

Hi Dale,

You're right, those functions are useful.

Thanks for the direction.

VW

Link to comment
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
 Share

  • Recently Browsing   0 members

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