Jump to content

_IE_Example problem with CheckBoxes & _IEFormElementGetCollection


Recommended Posts

hey guys, i just cant figure this out, i'm trying to use _IEFormGetCollection, _IEFormElementGetCollection and _IEFormElementCheckboxSelect to select the checkboxes in the example but failing miserably, i've tried every combination i can think of but just cant do it. any help appreciated

#include <IE.au3>
$oIE = _IE_Example ("form")
$i = 0
For $i = 0 To 2
    $form_get = _IEFormGetCollection ($oIE, $i)
    $j = 0
    For $j = 0 To 20
        $element_get = _IEFormElementGetCollection ($form_get, $j)
        _IEFormElementCheckboxSelect ($element_get, 0, "", 1, "byIndex")
    Next
Next
Edited by laffo16
Link to comment
Share on other sites

hey guys, i just cant figure this out, i'm trying to use _IEFormGetCollection, _IEFormElementGetCollection and _IEFormElementCheckboxSelect to select the checkboxes in the example but failing miserably, i've tried every combination i can think of but just cant do it. any help appreciated

#include <IE.au3>
$oIE = _IE_Example ("form")
$i = 0
For $i = 0 To 2
    $form_get = _IEFormGetCollection ($oIE, $i)
    $j = 0
    For $j = 0 To 20
        $element_get = _IEFormElementGetCollection ($form_get, $j)
        _IEFormElementCheckboxSelect ($element_get, 0, "", 1, "byIndex")
    Next
Next
Where did you get your arbitrary counts for $i and $j? You could just iterate the collections:
#include <IE.au3>

$oIE = _IE_Example("form")
$forms_get = _IEFormGetCollection($oIE)
$i = 0
For $oForm In $forms_get
    $form_get = _IEFormGetCollection($oIE, $i)
    $elements_get = _IEFormElementGetCollection($form_get)
    $j = 0
    For $oElement In $elements_get
        ConsoleWrite($i & "-" & $j & ":  " & $oElement.OuterHtml & @LF)
        $j += 1
    Next
    $i += 1
Next

You'll note from the output that not all the elements are checkboxes to begin with.

The examples in the help file for _IEFormElementCheckBoxSelect() work fine. Look at the first parameter passed to the function in those examples ($oForm) and compare to what you are trying to do.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

i got a little restless and so just started firing random arrows with $i and $j hoping to hit something. im just trying to tick one of those checkboxes without using _IEFormGetObjByName. thanks for the response, that .OuterHtml should come in handy.

from the ConsoleWrite in your code i see that "0 - 5" is "Basketball" (the 1st checkbox).

i dont see why this doesnt work

$forms_get = _IEFormGetCollection($oIE, 0)
$elements_get = _IEFormElementGetCollection($form_get, 5)
_IEFormElementCheckboxSelect ($elements_get, 1, "", 1, "byIndex")

i know that $elements_get must be an object, but isnt that what _IEFormElementGetCollection returns >_< im confused.

Edited by laffo16
Link to comment
Share on other sites

i got a little restless and so just started firing random arrows with $i and $j hoping to hit something. im just trying to tick one of those checkboxes without using _IEFormGetObjByName. thanks for the response, that .OuterHtml should come in handy.

from the ConsoleWrite in your code i see that "0 - 5" is "Basketball" (the 1st checkbox).

i dont see why this doesnt work

$forms_get = _IEFormGetCollection($oIE, 0)
$elements_get = _IEFormElementGetCollection($form_get, 5)
_IEFormElementCheckboxSelect ($elements_get, 1, "", 1, "byIndex")

i know that $elements_get must be an object, but isnt that what _IEFormElementGetCollection returns :( im confused.

Not just any object -- the FORM object. You don't refer directly to the checkbox object with that function. Look again at the parameters used in Example 2 of the help file.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Not just any object -- the FORM object. You don't refer directly to the checkbox object with that function. Look again at the parameters used in Example 2 of the help file.

>_<

thanks psalty, i think i have a better understanding now.

$form_get = _IEFormGetCollection($oIE, 0)

$elements_get = _IEFormElementGetCollection($form_get)

_IEFormElementCheckboxSelect ($elements_get, 1, "", 1, "byIndex")

is the correct way. i didnt hit it with my target practise earlier because the default value for _IEFormElementGetCollection is -1 haha :(

Edited by laffo16
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...