CheesyPuffs144 Posted April 26, 2006 Share Posted April 26, 2006 Is there an alternate way for me to select a choice from a dropdown SELECT form element? $o_form = _IEFormGetObjByName($oIE, "form") $select = _IEFormElementGetObjByName($o_form, "dropdownmenu") _IEFormElementSetValue($select, 2) Content changes based on the choice of the pulldown menu, but using _IEFormElementSetValue() doesn't seem to register with it. Any ideas? (Other than clicking on it, in which case I'd just write my whole script with pixel detection and whatnot... trying to keep the window in the background/minimized/etc) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 Is there an alternate way for me to select a choice from a dropdown SELECT form element?$o_form = _IEFormGetObjByName($oIE, "form") $select = _IEFormElementGetObjByName($o_form, "dropdownmenu") _IEFormElementSetValue($select, 2)Content changes based on the choice of the pulldown menu, but using _IEFormElementSetValue() doesn't seem to register with it. Any ideas? (Other than clicking on it, in which case I'd just write my whole script with pixel detection and whatnot... trying to keep the window in the background/minimized/etc); $i_index is the 0-based index of the option you wish to select $select.options ($i_index).selected = True Link to comment Share on other sites More sharing options...
CheesyPuffs144 Posted April 26, 2006 Author Share Posted April 26, 2006 Thanks. However, that also doesn't seem to work. But thank you for the fast reply. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 Thanks. However, that also doesn't seem to work. But thank you for the fast reply.To prove the concept try this script:#include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://www.quadryders.com/test/select_test.html") $oForm = _IEFormGetObjByName($oIE, "testform") $oSelect = _IEFormElementGetObjByName($oForm, "abcselect") For $i = 0 To 3 $oSelect.options ($i).selected = True Sleep(1000) Next Link to comment Share on other sites More sharing options...
CheesyPuffs144 Posted April 26, 2006 Author Share Posted April 26, 2006 Whoops. Sorry I didn't make myself clear. It is selecting the correct choice. But the dynamic content that (is supposed) to change with each different choice doesn't. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 26, 2006 Share Posted April 26, 2006 OK, then you need to add this... $select.options ($i_index).fireEvent("onchange") 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...
CheesyPuffs144 Posted April 26, 2006 Author Share Posted April 26, 2006 I get an error "The requestion action with this object has failed." The error is pointing at the line that Dale gave me. Also, a note: it's a dropdown menu, not the one shown in big_daddy's example. I called it select, cause that's what the element type came up as. Sorry for any confusion. I'll be gone for an hour or two, but thanks for the replies. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 26, 2006 Share Posted April 26, 2006 take a look at the page source... I think you'll see something with an onchange event handler specified. thinking about it, it is probably on the dropdown element instead of on the item that is where you want to fire the event. 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...
CheesyPuffs144 Posted April 27, 2006 Author Share Posted April 27, 2006 _IEFormElementSetValue($menu, 2) $menu.fireEvent("onchange") thanx 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