milos83 Posted January 16, 2014 Author Share Posted January 16, 2014 Nije beta, šta se treseš. Simpatična opaska. Link to comment Share on other sites More sharing options...
milos83 Posted January 16, 2014 Author Share Posted January 16, 2014 newer seen that one but... http://www.autoitscript.com/autoit3/docs/keywords/Volatile.htm Ti li si Srbislave čoveče?! Šta bi sa 3d igricama i ostalim? Link to comment Share on other sites More sharing options...
milos83 Posted January 16, 2014 Author Share Posted January 16, 2014 Meh, I forgot that you can make event functions execute synchronously. LOL and I wrote the code for that. Yes, you can get id or object that fired the event from within event function: expandcollapse popupGlobal $oIE = ObjCreate("InternetExplorer.Application") Local $oEventBrowser = ObjEvent($oIE, "Browser_", "DWebBrowserEvents2") Local $oEventLink1, $oEventButton2 ; to collect event objects to $oIE.navigate("about:blank") ;----------------------------------------------- While Sleep(100) WEnd ; THE END ;----------------------------------------------- Func Customize($oBrowser, ByRef $oEventLink1, ByRef $oEventButton2) Local $sHtml = '<body> <a id="idLink" href="#" title="Link" >Click me</a> <br><br> <button id="idButton" title="Button" >Click me</button> </body>' Local $oDoc = $oBrowser.document $oDoc.write($sHtml) $oBrowser.visible = True Local $oLink1 = $oDoc.getElementById("idLink") Local $oButton2 = $oDoc.getElementById("idButton") ; Event objects $oEventLink1 = ObjEvent($oLink1, "Event_", "HTMLAnchorEvents2") $oEventButton2 = ObjEvent($oButton2, "Event_", "HTMLButtonElementEvents2") EndFunc ;Events for browser Func Browser_OnQuit() Exit EndFunc Func Browser_DocumentComplete($oDisp, $sUrl) Customize($oDisp, $oEventLink1, $oEventButton2) EndFunc ; Events volatile Func Event_onmouseover($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onmouseover" & @CRLF) Switch $oEvtObj.srcElement Case $oIE.document.getElementById("idLink") $oEvtObj.srcElement.innerhtml = "Hovering Anchor" Case $oIE.document.getElementById("idButton") $oEvtObj.srcElement.innerhtml = "Hovering Button (click to Exit)" EndSwitch EndIf EndFunc volatile Func Event_onmouseout($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onmouseout" & @CRLF) Switch $oEvtObj.srcElement ; check Case $oIE.document.getElementById("idLink") $oEvtObj.srcElement.innerhtml = "Not Hovering Anchor" Case $oIE.document.getElementById("idButton") $oEvtObj.srcElement.innerhtml = "Not Hovering Button (click to Exit)" EndSwitch EndIf EndFunc volatile Func Event_onclick($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onclick" & @CRLF) If $oEvtObj.srcElement = $oIE.document.getElementById("idButton") Then $oIE.Quit() Exit EndIf EndIf EndFunc Then It has to be HTMLAnchorEvents2, HTMLButtonElementEvents2, etc... You can compare id-s or objects directly to get the one that fired (i'm checking objects in that example). That does it! Thanks 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