Sign in to follow this  
Followers 0
Ursie

IE.au3 and _IEFormElementOptionSelect

5 posts in this topic

HTML Info

-----------

<select name="paard">

<option></option>

<option value='23917'>angel</option>

<option value='33485'>Wyomi</option>

<option value='35153'>Mitsy's Special Love</option>

<option value='36656'>Sverre</option>

</select>

AutoIT3 Info

--------------

$oSelectPaard = _IEGetObjByName ( $oIE1 , "paard" , 0 )

_IEFormElementOptionselect ( $oSelectPaard , "Sverre" , 1 , "byText" , 1 )

The above code doesn't selcet the option I want . Do i do something wrong ? or does the code struggle with the epty option or what ?

To be honest I use the following code

_IEFormElementOptionselect ( $oSelectPaard , $horseName , 1 , "byText" , 1 )

And $horseName consistes of "Sverre"

If anybody can help me or give me some alternate code to try or to debug. Please all suggestions are welcome.

Thanks in advance.

P.S.

I tried the "byValue" option also already but even that doesn't work only the "byIndex" does his job.

Share this post


Link to post
Share on other sites



I don't have time to troubleshoot why it is not working, but here is a workaround until Dale has a chance to look at it.

$oSelect = _IEGetObjByName($oIE, "paard")
$oItems = $oSelect.Options
For $oItem In $oItems
    If $oItem.Text = $sHorseName Then
        If Not $oItem.selected Then
            $oItem.selected = True
        EndIf
    EndIf
Next

Share this post


Link to post
Share on other sites

Yes, in fact there is a problem here in IE.au3 with the null value/text. The value returned for the text turns out to be a numeric 0 instead of an empty string and a comparison of a (unexpected) numeric to any string evaluates to True.

I'll fix this in the next release. Thanks Bob for providing the workaround.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

No problem.

Thanks for the explanation, now I understand why it wasn't working.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thnx guys,

I was walking on my hands already. The script made me mad --> In love --> crazy well it made me everything but not happy :lmao:

Thnx for the workaround

Edited by Ursie

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