Juvigy Posted September 13, 2010 Share Posted September 13, 2010 I am trying to track status change on a IE "select " element. when i try something like: While 1 $oIE=_IEAttach($atachadres,"url") If $oIE<>0 Then ExitLoop Sleep(10000) WEnd $status = _IEGetObjById ($oIE, "status_change") ;~ MsgBox(0,"",$status.innertext) $asd = $status.attachEvent("onchange", "testing") I get "The requested action with this object has failed." error . "testing" is the name of the function i have. Tried replacing "testing" with testing() but still doesnt work. Even tried .addEventListener - js method but failed too. Anyone knows how to make this work? Link to comment Share on other sites More sharing options...
Authenticity Posted September 13, 2010 Share Posted September 13, 2010 Perhaps, something like this?#include <IE.au3> Local $oIE = _IECreate() Local $sHTML = "<form>" & @CRLF & _ "<p>Select a different option in the drop-down list box to trigger the onchange event." & @CRLF & _ "<select name=""selTest"" onchange=""alert('Index: ' + this.selectedIndex + '\nValue: ' + this.options[this.selectedIndex].value)"">" & @CRLF & _ "<option value=""Books"">Books</option>" & @CRLF & _ "<option value=""Clothing"">Clothing</option>" & @CRLF & _ "<option value=""Housewares"">Housewares</option>" & @CRLF & _ "</select> </p>" & @CRLF & _ "</form>" _IEBodyWriteHTML($oIE, $sHTML) Local $oSelect = _IEGetObjByName($oIE, "selTest") ObjEvent($oSelect, "_Select_") While _IEPropertyGet($oIE, "hwnd") <> 0 Sleep(100) WEnd Func _Select_onchange() ConsoleWrite($oSelect.options($oSelect.selectedIndex).value & @CRLF) EndFuncThe HTML source is from the onchange event example code from the MSDN web site. Link to comment Share on other sites More sharing options...
Juvigy Posted September 13, 2010 Author Share Posted September 13, 2010 10x . I see where my error is now! 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