0

I need this script to work, but without using _IEFormGetObjByName or _IEFormGetCollection, and while knowing only the Name of the radio buttons.

$oIE = _IE_Example ("form")
$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName ("input")
For $element In $oArray
If $element.Name = "radioExample" Then

_IEFormElementRadioSelect ($oDoc,2, "radioExample", 1, "byIndex")
msgbox(0,"","Found it")
Endif
Next

_IEFormElementGetValue & _IEAction work great, just reference them to the $oElement, and search for an appropriate $element.Name, but I can't get the _IEFormElementRadioSelect to work.

The only difference between the _IEFormElementRadioSelect command from the example script found in the AutoIt helpfile is the reference to $oDoc. In the helpfile this is $oForm, which is found with a _IEFormGetObjByName, which I can't use (the site I'm automating doesn't return any forms).

TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

2

Replace your _IEFormElementRadioSelect with _IEAction($element, "click")

Try this example; you can see the radio items being selected as the script runs:

#include <IE.au3>

$oIE = _IE_Example("form")
$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
    If $element.Name = "radioExample" Then
        _IEAction($element, "click")
        Sleep(2000)
    EndIf
Next
TylerH
  • 20,799
  • 66
  • 75
  • 101
Jos van Egmond
  • 2,370
  • 15
  • 19
  • Thanks man! Now I can get back to work on the main script I was building!! If I had 15 rep, I'd vote your awnser up, but unfortunately I don't – Electricaln00b Sep 14 '11 at 21:08
  • No problem, Thomas. We get rep for just answering a question as well. :) Marking as answered is all I ever wanted. – Jos van Egmond Sep 14 '11 at 21:20