Jump to content

_IE Selecting A Radio Without A Name


Recommended Posts

I'm trying to select one of these radios based upon a selection made in a GUI. I am trying to use _IEFormElementRadioSelect(), however I cannot use the NAME=listed here because everytime the page loads it changes to a random number. If there's any way to get the name by _IEFormElementGetCollection() or just to select it based on the _IEFormElementGetCollection() index that I have and would work just fine.

I've searched the forum a few times now and can't find any way to select the radios without names. Below is a part of the HTML...also if needed there are several of these Yes/No groups on the page.

<INPUT TABINDEX=5 TYPE=RADIO NAME=14924:599771169 VALUE=25 CHECKED>Yes score&nbsp;&nbsp;&nbsp;
<INPUT TABINDEX=5 TYPE=RADIO NAME=14924:599771169 VALUE=0>No score</FONT></TD>
Link to comment
Share on other sites

It's never easy huh?

assume you have a form reference $oForm

$oInputs = _IETagNameGetCollection($oForm, "input")

For $oInput in $oInputs
    If $oInput.type = "radio" Then
        $myName = $oInput.name
        ExitLoop
    EndIf
Next

; now you have the name

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

$oInputs = _IETagNameGetCollection($oForm, "input")

For $oInput in $oInputs
    If $oInput.type = "radio" Then
        $myName = $oInput.name
        ExitLoop
    EndIf
NextoÝ÷ ÙhZ·
.ÖÞ¶zËzÚ ¢Øk¢è!y§!±ëh~¶ý±©Ý±é^'z)ÞiÈ`®©jÆ©¦º)®&­y ÙèÂ)®²)ඡ×zZ0Â
+Æî¶)¬º·¢·lmæÞ²ÜÊÚ!jwez+H~Ø^­ë+axÇq©Ûzfy¬­ê¶ëaÊîɨ¢Ø^®Ø^éiÂ¥u·¦¹ÈZ¦Þr&­yÐSXëyèZ׶¦¢Ëh~Ø^r^nܺÚ"µÍÌÍÚHHÜ    ÌÍÛÒ[][ ÌÍÛÒ[]ÂY   ÌÍÛÒ[]HH    ][ÝÜY[É][ÝÈ[   ÌÍÛ^S[YHH    ÌÍÛÒ[][YBÙ[XÝØÙH    ÌÍÚHHBYÜX]BQQÕRTQSÔÑSPÕ
    ][ÝÉ][ÝË    ][ÝÉ][ÝË    ÌÍÛ^S[YK ][ÝÉ][ÝÊBØÙH  ÌÍÚHHÂYÜX]BQQÕRTQSÔÑSPÕ
    ][ÝÉ][ÝË    ][ÝÉ][ÝË    ÌÍÛ^S[YK ][ÝÉ][ÝÊB[Ù[XÝÌÍÚHH    ÌÍÚH
ÈB[Y^

Link to comment
Share on other sites

Try expaining more clearly and using real rather than "freehand" code...

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

Try expaining more clearly and using real rather than "freehand" code...

Dale

Sorry about that Dale. The page itself is basically an evaluation form. Has sections with a yes score/no score radio (which is the subject here) and areas for comments in many subareas. It looks like so:

Validation

oYes score oNo score <<<<<THe o's are radio buttons

Area 1 Comments

Area 2 Comments

Area 3 Comments

Tone/Demeanor

oYes score oNo score

Area 1 Comments

Area 2 Comments

Area 3 Comments

Area 4 Comments

...and so on and so forth. There are probably 15 sets of Yes/No radios like that and one near the end that is a group of 5 radio buttons.

What I want to know is how to use the code that you gave me to cycle through and grab values for each score/no score from my GUI easy evalutation form and make the score/no score selection on the website according to what the GUI says it should be. Now I'm using the code below to cycle through and see what to select where but I know there must be a better way...and it doesnt seem too reliable.

$oInputs = _IETagNameGetCollection($oForm, "input")
$i = 0
For $oInput in $oInputs
    
    If $oInput.type = "radio" Then
        Select 
            Case $i = 0 
                $myName = $oInput.name
                If GUICtrlGetState($CheckValidation) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 2 
                $myName = $oInput.name
                If GUICtrlGetState($CheckTD) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 4
                $myName = $oInput.name
                If GUICtrlGetState($CheckResolution) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 6
                $myName = $oInput.name
                If GUICtrlGetState($CheckExpectations) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 8
                $myName = $oInput.name
                If GUICtrlGetState($CheckPS) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 10
                $myName = $oInput.name
                If GUICtrlGetState($CheckRaiseTheBar) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 12
                $myName = $oInput.name
                If GUICtrlGetState($CheckActionRequired) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 14
                $myName = $oInput.name
                If GUICtrlGetState($CheckZeroCall) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 16
                $myName = $oInput.name
                If GUICtrlGetState($CheckRaiseTheBar) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 18
                $myName = $oInput.name
                If GUICtrlGetState($CheckRecap) = $GUI_UNCHECKED Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                EndIf
            Case $i = 20
                $myName = $oInput.name
                If GUICtrlGetState($CheckRecap) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 22
                $myName = $oInput.name
                If GUICtrlGetState($CheckRecap) = $GUI_CHECKED Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                EndIf
            Case $i = 24
                $myName = $oInput.name
                If GUICtrlRead($RadioResolved) Then
                    _IEFormElementRadioSelect($oform, 0, $myName, 1, "byIndex")
                ElseIf GUICtrlRead($RadioResolvedCallback) Then
                    _IEFormElementRadioSelect($oform, 1, $myName, 1, "byIndex")
                ElseIf GUICtrlRead($RadioResolvedNo) Then
                    _IEFormElementRadioSelect($oform, 2, $myName, 1, "byIndex")
                ElseIf GUICtrlRead($RadioResolvedNoPolicy) Then
                    _IEFormElementRadioSelect($oform, 3, $myName, 1, "byIndex") 
                ElseIf GUICtrlRead($RadioResolvedNoTransOK) Then
                    _IEFormElementRadioSelect($oform, 4, $myName, 1, "byIndex") 
                ElseIf GUICtrlRead($RadioResolvedTransferNo) Then
                    _IEFormElementRadioSelect($oform, 5, $myName, 1, "byIndex") 
                EndIf
        EndSelect
        $i = $i + 1
    EndIf
Next
Edited by MyDisplayName
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...