Sign in to follow this  
Followers 0
Lokeshverma

Drop Down menu label

6 posts in this topic

#1 ·  Posted (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 by Lokeshverma

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 :lmao:... or i'm completly on the wrong track :evil:...

Edited by Polyphem

This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

#3 ·  Posted (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. :lmao:

Edited by Lokeshverma

Share this post


Link to post
Share on other sites

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


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

Thnks buddy,the sorting is pretty easy as the menu labels have a standerd formate ;))

thnks again :lmao:

Share this post


Link to post
Share on other sites

Your welcome, always a pleasure to help ;)...


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0