sgmailer Posted June 25, 2006 Share Posted June 25, 2006 (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 June 25, 2006 by sgmailer Link to comment Share on other sites More sharing options...
Valuater Posted June 25, 2006 Share Posted June 25, 2006 1not sure... but there are two loops and the variable $i is not utilized... thus your result is done 10 times.. if thats what you wanted2maybeFor $savs = 1 to $optionsNum Step 18) Link to comment Share on other sites More sharing options...
nfwu Posted June 25, 2006 Share Posted June 25, 2006 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. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
MHz Posted June 25, 2006 Share Posted June 25, 2006 Dealing with Collections. Look at For...In...Next in the helpfile to loop through the collection. Link to comment Share on other sites More sharing options...
sgmailer Posted June 25, 2006 Author Share Posted June 25, 2006 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now