Queener Posted November 16, 2014 Share Posted November 16, 2014 (edited) This is my code $oDoc = _IEDocGetObj($oIE) $oArray = $oDoc.getElementsByTagName("input") For $element In $oArray If $element.ID = "optAddressChange2" Then _IEAction($element, "click") sleep(2000) EndIf The code works. Just want to know if there's a better way to select multiple radio in an array instead of using if statement all the way for it to select radios. Edited November 16, 2014 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
Gianni Posted November 16, 2014 Share Posted November 16, 2014 (edited) you could take note of the index of your target radio, and next time use directly the index to fire the target radio: for example first time find the index in a way like this: $oDoc = _IEDocGetObj($oIE) ; $oArray = $oDoc.getElementsByTagName("input") $oArray = _IETagNameGetCollection($oIE, "input") Local $nIndex = 0 For $element In $oArray If $element.ID = "optAddressChange2" Then ; _IEAction($element, "click") ConsoleWrite("The index of the wanted radio is " & $nIndex & @CRLF) ; this will tell you the index ; Sleep(2000) $nIndex += 1 EndIf Next and next time, supposing that the target element is the nr. 5, modify your code in something like this: $oElement = _IETagNameGetCollection($oIE, "input", 5) ; this suppose the target element is the nr. 5 _IEAction($oElement, "click") I hope this can help you Edited November 16, 2014 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Queener Posted November 16, 2014 Author Share Posted November 16, 2014 I used case statement and it worked out great. Thanks for your useful info; will be using it in the future. Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") 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