Sign in to follow this  
Followers 0
rbhkamal

Ie.au3: Listbox With Multiselect Enabled.

7 posts in this topic

I posted a similar post before but it had the wrong title.

http://www.autoitscript.com/forum/index.ph...topic=24603&hl=

(If you clicked the link, scroll all the way down)

How can I fix this?

Here is my autoIt code:

#include <IE.au3>
Global $oIE , $L_oForm , $L_oButton

$sUrl = @ScriptDir&"\list.html"

$oIE = _IECreate()
_IENavigate($oIE, $sUrl)
_IELoadWait($oIE , 500 )

$L_oForm = _IEFormGetObjByName($oIE, "MeshConnectionForm")
$L_oButton = _IEFormElementGetObjByName($L_oForm, "encryptionSourceStrings")

ConsoleWrite('Before = ' & _IEFormElementGetValue($L_oButton) & @lf & '>Error code: ' & @error & @lf)
MsgBox( 0 , "" , "" )
_IEFormElementSetValue($L_oButton, 2)
ConsoleWrite('After = ' & _IEFormElementGetValue($L_oButton) & @lf & '>Error code: ' & @error & @lf)

And here is the html source:

<form name="MeshConnectionForm" >
            <select name="encryptionSourceStrings" multiple = "1" size="8" style="width: 140px;">
                
                  <option value="0">None</option>
                
                  <option value="1">Idea</option>

                
                  <option value="2">DES</option>
                
            </select>
        </td>

when running the script with multiple = "1" here is what happens:

The wanted value gets highlighted

The value will be still the same as it was before. @@Debug( 'IEFormElementGetValue= 0 , IEFormElementGetValue= 0)

Now, if you delete the option multiple = "1" it will start working.@@Debug( 'Before = 0 , After = 1)


"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Also is there any way to select mutiple items at the same time?

I tried to use an array with _IEFormElementSetValue($Olistbox , $array ) but I got an error.

I also tried to put ("1 2", 1 2 , "(1,2)" , (1,2) , "[1 , 2]" , [1,2] and "1~2") as the value .. didn't work

Help please!

Edit: I tried "1|2" and didn't work.

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

Your trouble here is that there is a level of indirection built into OPTION and INPUT TYPE=CHECKBOX|RADIO elements. The value set by SetValue changes the value that the element will send back IF IT IS SELECTED/CHECKED -- it des not select or check the item with that value and result in it being returned by a POST action.

You need to get references to the specific elements and then use either the selected or checked attributes. E.g.:

$oOptionselectElement.selected = True

$oCheckBoxElement.checked = True

There are some examples in the forum and I think that I placed a link to discussion of this at the end of reply3 (the examples) in the IE.au3 post.

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

#4 ·  Posted (edited)

Your trouble here is that there is a level of indirection built into OPTION and INPUT TYPE=CHECKBOX|RADIO elements. The value set by SetValue changes the value that the element will send back IF IT IS SELECTED/CHECKED -- it des not select or check the item with that value and result in it being returned by a POST action.

You need to get references to the specific elements and then use either the selected or checked attributes. E.g.:

$oOptionselectElement.selected = True

$oCheckBoxElement.checked = True

There are some examples in the forum and I think that I placed a link to discussion of this at the end of reply3 (the examples) in the IE.au3 post.

Dale

Thanks, much appreciated :think::(:);):D

I will try it

Edit: No, It's not working

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$oOptionselectElement.selected = True

$oCheckBoxElement.checked = True

There are some examples in the forum and I think that I placed a link to discussion of this at the end of reply3 (the examples) in the IE.au3 post.

Dale

Dear Dale,

I read all your examples and looked every where in this forum and I didn't find an answer yet.

How can you do it with Lisboxes!? (mutiple values under the same name)

how can you get a reference to "None"?

<form name="MeshConnectionForm" >
            <select name="encryptionSourceStrings" multiple = "1" size="8" style="width: 140px;">
                
                  <option value="0">None</option>
                
                  <option value="1">Idea</option>

                
                  <option value="2">DES</option>
                
            </select>
        </td>

I all ready tried _IEFormElementsetValue() but as I said there was a problem.

Obviously Im DUM :) ,so could you please explain a little bit more?

I wasted on this four days so far. ;):think::(

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

Obviously Im DUM :think:

Nah, this is not intuitive stuff and IE.au3 could do a lot more to help for these form elements than it does...

Take a look here for some discussion and an example.

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

#7 ·  Posted (edited)

Nah, this is not intuitive stuff and IE.au3 could do a lot more to help for these form elements than it does...

Take a look here for some discussion and an example.

Dale

YEAAAAAAAAAAAAAAAHH

Finally man, you got me FIXED.

Thank you

:think::(:)

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

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