rbhkamal Posted April 13, 2006 Share Posted April 13, 2006 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 Link to comment Share on other sites More sharing options...
rbhkamal Posted April 14, 2006 Author Share Posted April 14, 2006 (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 April 14, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
DaleHohm Posted April 14, 2006 Share Posted April 14, 2006 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 Link to comment Share on other sites More sharing options...
rbhkamal Posted April 14, 2006 Author Share Posted April 14, 2006 (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. DaleThanks, much appreciated I will try it Edit: No, It's not working Edited April 14, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
rbhkamal Posted April 14, 2006 Author Share Posted April 14, 2006 (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. DaleDear 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. Edited April 14, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
DaleHohm Posted April 14, 2006 Share Posted April 14, 2006 Obviously Im DUM 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 Link to comment Share on other sites More sharing options...
rbhkamal Posted April 14, 2006 Author Share Posted April 14, 2006 (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.DaleYEAAAAAAAAAAAAAAAHHFinally man, you got me FIXED.Thank you Edited April 14, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
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