Jump to content

Recommended Posts

Posted (edited)

When I set AutoIt to receive events from Internet Explorer there is a problem with writing in the browser, the browser reacts slower when I write something so it is difficult to write, so there is a problem with responsiveness. Is this problem with Internet Explorer or maybe something in AutoIt? I have this problem on one computer with Internet Explorer 10 and other with Internet Explorer 9. The problem may not be that visible at first.

Here is some code:

$hIEWindow = WinGetHandle("[CLASS:IEFrame]")
$oShell = ObjCreate("Shell.Application")
$oWindows = $oShell.Windows()
For $oWindow In $oWindows
   If HWnd($oWindow.HWnd) = $hIEWindow Then
   $oIE = $oWindow
   $oIEEvent = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2")
   If @Error = 0 Then MsgBox(0, "", "Found the browser.")
   While Sleep(200)
   WEnd
   EndIf
Next
Func IEEvent_BeforeNavigate2($oIE, $sURL) 
   Beep()
EndFunc















Edited by grzesiek
Posted

tak lepiej :)

thats better

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Read the description of the parameters for the function Beep()

Special focus on the second parameter.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

What your script do inside While <> Wend loop ?

EDIT:

And what doing inside IEEvent_BeforeNavigate2 function ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I also tryed this code and when events are enabled only one, maybe few test words are typed, but when events are disabled every time all test words are typed. I tested it also with the text box in this forum. Well I will just don't use events and check in a loop if a change have been made, I think it will be more efficient.

;Opt("SendKeyDelay", 0)

$hIEWindow = WinGetHandle("[CLASS:IEFrame]")
If @Error Then
   MsgBox(0, "", "Unable to find IE window.")
   Exit
EndIf
WinSetState($hIEWindow, "", @SW_RESTORE)
MsgBox(0, "Events are disabled", "Click in a text box then click OK to send text.")
WinActivate($hIEWindow)
Sleep(1000)
Send("test test test test test test test test test test test test", 1)
Sleep(3000)

$oShell = ObjCreate("Shell.Application")
$oWindows = $oShell.Windows()
$oIE = 0
For $oWindow In $oWindows
   If HWnd($oWindow.HWnd) = $hIEWindow Then
      $oIE = $oWindow
      ExitLoop
   EndIf
Next
If IsObj($oIE) = 0 Then
   MsgBox(0, "", "Unable to find IE window.")
   Exit
EndIf

$oIEEvent = 0
While 1
   $oIEEvent = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2")
   If @Error Then
      MsgBox(0, "", "Error")
      Exit
   EndIf
   MsgBox(0, "Events are enabled", "Remove text and click OK to send text.")
   WinActivate($hIEWindow)
   Sleep(1000)
   Send("test test test test test test test test test test test test", 1)
   Sleep(3000)
   
   $oIEEvent.Stop
   MsgBox(0, "Events are disabled", "Remove text and click OK to send text.")
   WinActivate($hIEWindow)
   Sleep(1000)
   Send("test test test test test test test test test test test test", 1)
   Sleep(3000)
WEnd

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...