Jump to content

Recommended Posts

Posted

k this is probably a really noob thing to want but I need a bot to research a topic of my choice.... now I can get to the point that I open google and search a topic but I need to get it to get the web links and use inet get to get the webpage. Here is the code so far......

#include <IE.au3>
HotKeySet("`","topic")

While 1
    Sleep(100)
WEnd

Func topic()
$oIE = _IECreate("www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
$research = InputBox("What to research?","What do you want to research?")
_IEFormElementSetValue ($oQuery, $research)
_IEFormSubmit ($oForm)
EndFunc
  • Moderators
Posted (edited)

This was the best way I could find...

#include <IE.au3>
HotKeySet("`", "topic")

_IEErrorHandlerRegister()
_IEErrorNotify(0)

While 1
    Sleep(100)
WEnd

Func topic()
    $oIE = _IECreate("www.google.com")
    $oForm = _IEFormGetCollection($oIE, 0)
    $oQuery = _IEFormElementGetCollection($oForm, 1)
    $research = InputBox("What to research?", "What do you want to research?")
    _IEFormElementSetValue($oQuery, $research)
    _IEFormSubmit($oForm)
    $oRes = _IEGetObjById($oIE, "res")
    $oDivs = _IETagNameGetCollection($oRes, "DIV")
    For $oDiv In $oDivs
        If String($oDiv.className = "g") Then
            $oTemp = $oDiv.firstChild
            If String($oTemp.className = "r") Then
                $oTemp = $oTemp.firstChild
                If String($oTemp.className = "1") Then
                    $sHREF = String($oTemp.href)
                    If $sHREF <> "" Then
                        ConsoleWrite($sHREF & @CR)
                    EndIf
                EndIf
            EndIf
        EndIf
    Next
EndFunc   ;==>topic
Edited by big_daddy

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
×
×
  • Create New...