Ohrstrom Posted March 8, 2009 Posted March 8, 2009 (edited) Hi! I've searched for an answer to this simple question for a couple of hours now, and it's driving me crazy. On a web page, there's a dropdown box. I want to know the number of options that are in the box. How do I get that value? I've tried this: CODE $oForm = _IEFormGetObjByName ($oIE, "engagementForm") ; Name of form $oSelect = _IEFormElementGetObjByName ($oForm, "engagementNumber") ; Name of dropdown box _IEFormElementGetCollection ($oSelect) $oOptions = @extended MsgBox(0, "Info", "There are " & $oOptions & " options in the box") but it just returns 1. Am I using the wrong function or what is the matter? I'm sure it's quite easy, but I just can't see it. Please help! Edited March 9, 2009 by Ohrstrom
PsaltyDS Posted March 9, 2009 Posted March 9, 2009 (edited) Hi! I've searched for an answer to this simple question for a couple of hours now, and it's driving me crazy. On a web page, there's a dropdown box. I want to know the number of options that are in the box. How do I get that value? I've tried this: $oForm = _IEFormGetObjByName ($oIE, "engagementForm"); Name of form $oSelect = _IEFormElementGetObjByName ($oForm, "engagementNumber"); Name of dropdown box _IEFormElementGetCollection ($oSelect) $oOptions = @extended MsgBox(0, "Info", "There are " & $oOptions & " options in the box") but it just returns 1. Am I using the wrong function or what is the matter? I'm sure it's quite easy, but I just can't see it. Please help! Try $oSelect.length: #include <IE.au3> $oIE = _IE_Example ("form") $oForm = _IEFormGetObjByName ($oIE, "ExampleForm") $oSelect = _IEFormElementGetObjByName ($oForm, "selectExample") $iOptionCount = $oSelect.length ConsoleWrite("Length = " & $iOptionCount & @LF) For $i = 1 To 10 For $n = 0 To $iOptionCount - 1 _IEFormElementOptionselect ($oSelect, $n, 1, "byIndex") Sleep(1000) Next Next Edit: Improved demo. Edited March 9, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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