Jump to content

Recommended Posts

Posted (edited)

Every variable and object has been declared properly.

These two for-loops are to simply select an element from a drop-down menu, select a radio button, and then submit the form. The program selects the element from the drop-down menu fine but then stops due to this error:

C:\Program Files\AutoIt3\beta\Include\IE.au3 (1396) : ==> The requested action with this object has failed.:

If $f_fireEvent Then $oItems.item ($i_index).fireEvent ("onchange")

If $f_fireEvent Then $oItems.item ($i_index).fireEvent ("onchange")^ ERROR

Here is the code segment:

For $savs = 0 to $optionsNum Step 1
    For $i = 1 to 10 Step 1
        $o_form = _IEFormGetCollection($oIE, 0)
        $dropMenu = _IEFormElementGetCollection($o_form, "0")
        _IEFormElementOptionselect($dropMenu, $savs, 1, "byIndex")
        _IEFormElementRadioSelect($o_form, "bleh", "go", 1)
        _IEFormSubmit($o_form)
        _IENavigate($oIE, "http://www.blahblahsite.com")
    Next
NextoÝ÷ Ø    l£­­¶¢YhÂ)à)Þjëh×6_IEFormElementOptionselect($dropMenu, $savs, 1, "byIndex")
the program executes fine.

I'm suspecting that there might be a syntax error somewhere but I fail to spot it.

If you need the rest of the short little program, feel free to ask.

Thanks in advance.

Edited by sgmailer
Posted

1

not sure... but there are two loops and the variable $i is not utilized... thus your result is done 10 times.. if thats what you wanted

2

maybe

For $savs = 1 to $optionsNum Step 1

8)

NEWHeader1.png

Posted

For $savs = 0 to $optionsNum Step 1
    For $i = 1 to 10 Step 1
        MsgBox(0, "DEBUG", "$i = "&$i&@CRLF&"$savs = "&$savs)
        $o_form = _IEFormGetCollection($oIE, 0)
        $dropMenu = _IEFormElementGetCollection($o_form, "0")
        _IEFormElementOptionselect($dropMenu, $savs, 1, "byIndex")
        _IEFormElementRadioSelect($o_form, "bleh", "go", 1)
        _IEFormSubmit($o_form)
        _IENavigate($oIE, "http://www.blahblahsite.com")
    Next
Next

Try adding some debug code (like the one above) to your script so that you know exactly when it breaks down.

#)

Posted

Thanks for the help everybody but just through some trial and error, I realized that the problem was with the line with the function _IEFormElementOptionselect.

For $savs = 0 to $optionsNum Step 1
    For $i = 1 to 10 Step 1
        MsgBox(0, "DEBUG", "$i = "&$i&@CRLF&"$savs = "&$savs)
        $o_form = _IEFormGetCollection($oIE, 0)
        $dropMenu = _IEFormElementGetCollection($o_form, "0")
        _IEFormElementOptionselect($dropMenu, $savs, 1, "byIndex", 0) ;<--- added a 0 in the parameters to  make it not fire onchange event after setting value
        _IEFormElementRadioSelect($o_form, "bleh", "go", 1)
        _IEFormSubmit($o_form)
        _IENavigate($oIE, "http://www.blahblahsite.com")
    Next
Next

Can anyone tell me what that means? What is an onchange event?

Thanks.

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...