diikee Posted June 16, 2008 Share Posted June 16, 2008 <SELECT id=OidSB1.2.3 onchange=setEcam(this) name=OidSB1.2.3><OPTION>xlow<OPTION>low<OPTION selected>medium<OPTION>high</OPTION></SELECT>$oForm = _IEFormGetObjByName ($oIE, "myform") $sh = _IEFormElementGetObjByName ($oForm, "OidSB1.2.3") For $s In $sh $sopt = _IETagNameGetCollection($sh, "OPTION") For $sop in $sopt ConsoleWrite($sop.selected & @CRLF) Sleep(2000) $o = $sop.innerText --->>>>this prints the options name ConsoleWrite($o & @CRLF) _IEFormElementOptionselect($sh, $o, 1, "byText") ConsoleWrite($sopt.selected & @CRLF)------->>>>Prints a 0 instead of the selected option Sleep(1000) Next ExitLoop NextShouldn't it print "medium"??? instead of 0's Link to comment Share on other sites More sharing options...
therks Posted June 16, 2008 Share Posted June 16, 2008 Don't think so. I'm not sure about AutoIt but when using Javascript the proper way to get the text of a selected option is to first get the select element's selectedIndex property, then use that to determine which option in the select to check the text from. Something like the following:(Javascript, not AutoIt code) selectObject = document.formName.selectName index = selectObject.selectedIndex selectedText = selectObject[index].text My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
diikee Posted June 16, 2008 Author Share Posted June 16, 2008 Can I incorporate the java code into autoit script?? Link to comment Share on other sites More sharing options...
therks Posted June 16, 2008 Share Posted June 16, 2008 I dunno, maybe. You'd be better off just figuring out how it works in AutoIt though, I imagine it's not a whole lot different. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
DaleHohm Posted June 17, 2008 Share Posted June 17, 2008 In your example, $sopt is a Tagname Collection rather than an Options Collection. You need to get the Options collection... these should help you: $sh.options.selectedIndex $sh.options.selectedIndex.text $sh.options.selectedIndex.value 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...
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