Jump to content

Search the Community

Showing results for tags 'objevent'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 5 results

  1. I have this AutoIt script that works on Windows 7. However, when I test it on Windows 10, the objEvent will not execute the function it's supposed to call. So I have a webpage the script will check if it is active, then it will search if a popup button exist (elementId), if so, assign it to the event handler so that when that button is clicked, then handler function will move the focus back to the main GUI again. If WinActive("Website Title - Internet Explorer") Then    $ie = _IEAttach("Website Title")    $objElement= _IEGetObjById ($ie, "elementId")    local $oEvent = ObjEvent($objElement, "_MY_EVENT_HANDLER_") EndIf Func _MY_EVENT_HANDLER_onclick($oEvtObj)     msgbox(0,"Alert Window", "Button Clicked!") setMainWindow() ; sets focus back to main GUI EndFunc I've verified, on Windows 10, that it does see the object element. But it will not trigger the event. Could it be related to some timing issues due to Windows 10 Internet Explorer over Windows 7 Internet Explorer? Windows 7 IE version 11.0.9600.19507 Windows 10 IE version 11.418.18362.0 AutoIt v 3.3
  2. I'm trying to use the COM interface to create an object . Here is the reference url:https://msdn.microsoft.com/zh-tw/library/windows/desktop/aa384106.aspx I failed to use the event ,actually I have no idea about how to. I take the example in objectevent. apparently I do not get the key point. here is my code. Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Global $oHttp = ObjCreate('WinHttp.WinHttpRequest.5.1') Global $ohttpevent= ObjEvent($oHttp, 'IWinEvents_','IWinHttpRequestEvents') $oHttp.SetTimeouts(60000, 60000, 60000, 5000); $oHttp.open('GET', $reqauth, False) $oHttp.send() $oHttp.waitforresponse() $sBody = BinaryToString($oHttp.responsebody(), 4) ConsoleWrite('$sBody1=' & $sBody & @CRLF) Func IWinEvents_OnError($lerrnum,$wserrdes) ConsoleWrite('Error! error code='&Hex($lerrnum)&@TAB&'description='&$wserrdes) EndFunc Func IWinEvents_OnResponseDataAvailable($punchar) ConsoleWrite('stringlen='&StringLen($punchar)&@TAB&'content='&$punchar&@CRLF) EndFunc Func IWinEvents_OnResponseFinished() ConsoleWrite('ResponseFinished!'&@CRLF) EndFunc Func IWinEvents_OnResponseStart($long,$wscontent) ConsoleWrite('status='&$long&@TAB&'ContentType='&$wscontent&@CRLF) EndFunc Func _ErrFunc($oError) ; Do anything here. ConsoleWrite("err.number is: " & @TAB & Hex($oError.number, 8)& @CRLF & _ "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ "err.description is: " & @TAB & $oError.description & @CRLF & _ "err.source is: " & @TAB & $oError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
  3. Hello, i'm trying to use this UDF _IEquerySelectorAll() to check if i clicked a button in a web page. here is the index.html: and this is my autoit script including the _IEquerySelectorAll() function (modified by mLipok) : well, so i'm supposed to see a msgbox when i click the button, but nothing happens... Can someone help me please ? something should be wrong here: $oDoc = _IEDocGetObj($oIE) $oButton = _IEquerySelectorAll($oDoc,'button', 0) ObjEvent($oButton, "_Evt_") Func _Evt_onClick() msgbox(0,"","button clicked") EndFunc
  4. Hello and happy new Year to everybody! I'm trying to catch some events occuring within a browser control by simply using the ObjEvent() function. I think I'm not using that function in a proper way since some events are captured, while other are not. more precisely, events like those listed in this page are working: https://msdn.microsoft.com/en-us/library/aa769764(v=vs.85).aspx while other events listed in other "interfaces", as in the following links, does not works. https://msdn.microsoft.com/en-us/library/hh801967(v=vs.85).aspx For exemple, Here I would like to catch events like "DragOver" and/or "Drop" fired while dragging the image on the web control, but I'm not been able to obtain a result. Those events are listed in the HTMLDocumentEvents4 interface or also in the HTMLImgEvents interface, but I failed to use them. Any hint that can help to see what I'm doing wrong, or even better that can show how to achieve the result by using the ObjEvent() function (if it's possible?) is welcome. Thanks a lot. Here is the simple script that I'm using for my tests: #include <GUIConstantsEx.au3> #include <string.au3> ; read html page from bottom of this script ; and write it to a file on disk for later ; usage by the $oIE.navigate CreateHtmlPage() Example() Exit Func Example() Local $hGUIMain = GUICreate("Event Test", 540, 400) ; We generate the Browser Control... Global $oIE = ObjCreate("Shell.Explorer.2") ; and we embed it into the AutoIt GUI $hIE = GUICtrlCreateObj($oIE, 5, 5, 530, 390) GUISetState() ;Show GUI ; load in the browser our previously created web page $oIE.navigate('file:///' & @ScriptDir & '\Page.html') Do ; wait for document Sleep(250) $oDocument = $oIE.document Until IsObj($oDocument) $oDocument.execCommand("Refresh") ; --- Setup catch of events --- Local $oEventObjects[2] $oImage = $oDocument.getElementById('drag1') ; Object reference to The image on the page ; https://msdn.microsoft.com/en-us/library/aa769764(v=vs.85).aspx ; HTMLDocumentEvents2 interface (catch OnClick, OnMouseOver, .... etc ; ObjEvent() "Handles incoming events from the given Object." ; ObjEvent($oParam1, $sParam2 [,$sParam3]) ; Parameters ; $oParam1 A variable containing an Object from which you want to receive events ; ; $sParam2 The prefix of the functions you define to handle receiving events. ; The prefix is appended by the Objects method name. ; ; $sParam3 "interface name" [optional] name of an Event interface to use. ; Note: It must be a supported as outgoing for the Object AND it must be of type DISPATCH. ; Using third parameter as "HTMLDocumentEvents2" as event interface, or even leaving it blank, ; is the only way by which I've been able to catch some events from the browser control ; OK, events listed here are catched --> https://msdn.microsoft.com/en-us/library/aa769764(v=vs.85).aspx $oEventObjects[0] = ObjEvent($oDocument, "IEEvent2_") ;, "HTMLDocumentEvents2") ; when I try to catch events fired by the Image dragged on the web page ; following attempts do not work (no event is captured and passed to AutoIt) ; $oEventObjects[1] = ObjEvent($oDocument, "IEEvent2_", "HTMLDocumentEvents2") ; $oEventObjects[1] = ObjEvent($oDocument, "IEEvent2_", "HTMLDocumentEvents4") ; $oEventObjects[1] = ObjEvent($oImage, "IEEvent2_", "HTMLDocumentEvents2") ; $oEventObjects[1] = ObjEvent($oImage, "IEEvent2_") $oEventObjects[1] = ObjEvent($oImage, "IEEvent2_", "HTMLImgEvents2") ; ----------------------------- ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; the end For $i = 0 To UBound($oEventObjects) - 1 $oEventObjects[$i].Stop ; Tell IE we don't want to receive events. $oEventObjects[$i] = 0 Next $oEventObject = 0 ; Kill the Event Object $oIE = 0 ; Remove IE from memory (not really necessary). GUIDelete($hGUIMain) ; Remove GUI EndFunc ;==>Example ; below function should be fired by events ; occurred in the browser's objects ; --- events management zone --- Volatile Func IEEvent2_onClick($oEvent) ConsolePrint("mouse click:") EndFunc ;==>IEEvent2_onClick Volatile Func IEEvent2_onDblClick($oEvent) ConsolePrint("mouse DoubleClick:") EndFunc ;==>IEEvent2_onDblClick ; Drag related events Volatile Func IEEvent2_onDragstart($oEvent) ConsolePrint("Drag action started") EndFunc ;==>IEEvent2_onDragstart ; --- following events are not catched --- ??? Volatile Func IEEvent2_onDragOver($oEvent) ConsolePrint("DragOver event") EndFunc ;==>IEEvent2_onDragOver Volatile Func IEEvent2_onDrop($oEvent) ConsolePrint("Drop action performed ") EndFunc ;==>IEEvent2_onDrop ; ------------------------------ Func ConsolePrint($sMsg) ConsoleWrite($sMsg & @CRLF) EndFunc ;==>ConsolePrint Func CreateHtmlPage() Local $sStart = @LF & "#cs;HTML" Local $sEnd = "#ce;HTML" & @CR Local $aArray = _StringBetween(FileRead(@ScriptFullPath), $sStart, $sEnd) Local $sPage = @ScriptDir & '\Page.html' Local $hFile = FileOpen($sPage, 2) ; $FO_OVERWRITE (2) = Write mode (erase previous contents) FileWrite($hFile, $aArray[0]) FileFlush($hFile) FileClose($hFile) EndFunc ;==>CreateHtmlPage ; example got from here: http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_draganddrop2 #cs;HTML <!DOCTYPE HTML> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <style> #div1, #div2 { float: left; width: 214px; height: 214px; margin: 5px; padding: 10px; border: 1px solid black; } </style> <script> function allowDrop(ev) {ev.preventDefault();} function drag(ev) {ev.dataTransfer.setData("text", ev.target.id);} function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data));} </script> </head> <body> <h2>Drag and Drop</h2> <p>Drag the image back and forth between the two div elements.</p> <div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"> <img src="https://www.autoitscript.com/forum/uploads/monthly_2016_01/Chimp.jpg.688f81fa865450e2913b5dc2cb56215f.thumb.jpg.96a6bfa47c0fb8476f39aaf55ad68ed0.jpg" draggable="true" ondragstart="drag(event)" id="drag1" width="214" height="214"> </div> <div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div> </body> </html> #ce;HTML ;
  5. I have e.g. Local $oIEEvents = ObjEvent(_IEGetObjById($oIE, "mylink"), "_MyLink_", "HTMLAnchorEvents2")working perfectly, but Local $oIEEvents = ObjEvent(_IEGetObjById($oIE, "future_btn"), "_Futurebtn_", "HTMLButtonElementEvents ")does not as ExtJS has not dynamically created the html yet. Is there anything in the IE API that would allow a callback to $oIE once the html is available?
×
×
  • Create New...