Lokeshverma Posted November 23, 2006 Posted November 23, 2006 (edited) I m a newbee. plz. help me out.. a form dropdown menu source code is like :- <option value="658">NYM219(214 Broadway)</option> <option value="174">NYM234(270 Park Avenue)</option> ..................... I have to get the texts/labels i.e. NYM219(214 Broadway) or NYM234(270 Park Avenue) or.......................... I hav selected the options in dropdownmenu as $oIE = _IECreate ("XYZ") $oForm = _IEFormGetObjByName ($oIE, "form1") $oText = _IEFormElementGetObjByName($oForm, "company") _IEFormElementOptionselect ($oText,4, 1,"byIndex") MsgBox (0,"XYZ", _IEFormElementGetValue($oText)) but this gives the value of the option i.e. 658 or 174 or .................... Plz. dont laugh if its a stupid problem. Edited November 23, 2006 by Lokeshverma
Polyphem Posted November 23, 2006 Posted November 23, 2006 (edited) Hm, not sure about this one, as i never used it... but by looking at it with _IEFormElementGetValue you get exactlly what you wanted, the value of the option, in this case 658 or 174. By looking at the source of the include IE.au3 i could not find another solution already implemented (but surly Im wrong ). A work-around which might work (purly speculation) might be, to copy the _IEFormElementGetValue() function and edit that to capture the inner text of the element... maybe this works, insert it at the bottom of your script: Func _IEFormElementGetText(ByRef $o_object) If Not IsObj($o_object) Then __IEErrorNotify("Error", "_IEFormElementGetValue", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; If Not __IEIsObjType($o_object, "forminputelement") Then __IEErrorNotify("Error", "_IEFormElementGetValue", "$_IEStatus_InvalidObjectType") SetError($_IEStatus_InvalidObjectType, 1) Return 0 EndIf ; SetError($_IEStatus_Success) Return $o_object.innerText;<=== changed to innerText EndFunc and replace this line in your code MsgBox (0,"XYZ", _IEFormElementGetValue($oText)) with this MsgBox (0,"XYZ", _IEFormElementGetText($oText)) maybe, just maybe ... or i'm completly on the wrong track ... Edited November 23, 2006 by Polyphem This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Lokeshverma Posted November 23, 2006 Author Posted November 23, 2006 (edited) Actually it worked But not the way I wanted.... it gave me all the inner texts of the drop down menu written 1 after another. I have to sort them,but its not easy. Edited November 23, 2006 by Lokeshverma
Polyphem Posted November 23, 2006 Posted November 23, 2006 Nice ... Yeah, i see, the function seems to refer to the <form> element and not the <option> element ... guess you'll have to combine the _IEFormElementGetText with a _IEFormElementGetValue function call. Extract _IEFormElementGetValue and _IEFormElementGetText. Split the resulting _IEFormElementGetText string with the value retrieved from _IEFormElementGetValue, something like that ... This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Lokeshverma Posted November 23, 2006 Author Posted November 23, 2006 Thnks buddy,the sorting is pretty easy as the menu labels have a standerd formate ) thnks again
Polyphem Posted November 23, 2006 Posted November 23, 2006 Your welcome, always a pleasure to help ... This post will be edited again by Polyphem: Tomorrow, 11:55 AM
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