Jump to content
Sign in to follow this  

I need some serious help

Recommended Posts


alrighty.. i'm a complete noob at this... i have a script that i got a while ago and i've jsut been trying to work off of that to see what each thing does... i can't seem to find out what a few things are... so if you can then please explain what each part of the script(below) does... and please use the simplest terms if you can:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")

_IEFormElementSetValue($oQuery, "your ugly search string")

MyClickLinkByText($oIE, "Next"); There is no good "ugly" link on the first page, goto Next
MyClickLinkByText($oIE, "ugly"); click on the ugly link


Func MyClickLinkByText($o_object, $s_linkText, $i_index = 0, $f_wait = 1)
; _IE_clickLinkText( $o_object, $s_linkText [, $i_index][, $f_wait])
; $o_object - Object Valiable pointing to an InternetExplorer.Application object
; $s_linkText - linkText, the text displayed on the web page for the desired link to click
; [$i_index] - if the link text occurs more than once, specify which instance you want to click
;        note: instance numbering starts at 0
    $doc = $o_object.document
    $links = $doc.links
    $found = 0
    For $link In $links
        $linkText = $link.outerText & ""; Append empty string to prevent problem with no outerText (image) links
        If StringInStr($linkText, $s_linkText) Then;;; Look for SubString instead of exact match
            if ($found = $i_index) Then
                $result = $link.click
                If ($f_wait = 1) Then _IELoadWait($o_object)
                Return 1
            $found = $found + 1
    Return 0

I've read the post on what each thing does but it doens't make sense to me. For example the:

$oForm = _IEFormGetObjByName($oIE, "f")

$oQuery = _IEFormElementGetObjByName($oForm, "q")

I Don't get what that means.. I know it sets the vairable but whats a form and whats an element??

Edited by Mr.Sniper

Share this post

Link to post
Share on other sites

This is all based on IE.au3 A majority of your example is a modified version of the _IEClickLinkByText() function and if you are just trying to learn, you should walk away from it and revert to the original version (this one just allows a sub-string match vs. an exact match).

IE Automation UDF Library

Examples are inPost 3 in the IE Automation thread

Your questions about Forms and FormElements -- you need to understand the basics of HTML and HTML forms or you will not get very far with this. Please try to bring yourself up to speed by studying the IE.au3 post.


Edited by DaleHohm

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

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