Jump to content
Sign in to follow this  
Krol

DWebBrowserEvents2 - fatal error on NewWindow event

Recommended Posts

Krol

Hello!

I need to use DebBroserEvents2 interface and Shell.Explorer.2 but my script produces a fatal error for NewWindow event

AutoIT3.exe ended.rc:-1073741819

Example:

#include <GUIConstantsEx.au3>
Global $oIE = ObjCreate("Shell.Explorer.2")
Global $oIEEvent = ObjEvent($oIE, "_IEEvent_", "DWebBrowserEvents2")
;~ Global $oIEEvent = ObjEvent($oIE, "_IEEvent_", "DWebBrowserEvents") ; no error, but this interface is obsolete
$Form1 = GUICreate("Form1", 625, 450, -1, -1)
$Shell = GUICtrlCreateObj($oIE, 0, 0, 625, 450)
$oIE.Navigate("about:blank")
$oIE.document.body.innerHTML = '<a href="http://www.autoitscript.com" target="_blank">New window</a> (click by link)'

GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Func _IEEvent_BeforeNavigate2($oIE, $sURL, $sFlags, $sTargetFrameName, $sPostData, $sHeaders)
  ConsoleWrite("+======================================================" & @CR & _
               "-_IEEvent_BeforeNavigate2" & @CR & _
               "-->$oIE:" & @TAB & $oIE & @CR & _
               "-->$sURL:" & @TAB & $sURL & @CR & _
               "-->$sFlags:" & @TAB & $sFlags & @CR & _
               "-->$sTargetFrameName:" & @TAB & $sTargetFrameName & @CR & _
               "-->$sPostData:" & @TAB & $sPostData & @CR & _
               "-->$sHeaders:" & @TAB & $sHeaders & @CR & _
               "+======================================================")
EndFunc
Func _IEEvent_NavigateComplete2($oIE, $sURL)
  ConsoleWrite("+======================================================" & @CR & _
               "-_IEEvent_NavigateComplete2" & @CR & _
               "-->$oIE:" & @TAB & $oIE & @CR & _
               "-->$sURL:" & @TAB & $sURL & @CR & _
               "+======================================================")
EndFunc

Thanks for any help!

Share this post


Link to post
Share on other sites
trancexx

It's a bug since forever. Will be fixed for next beta.

Thanks for finding.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

    • SkysLastChance
      By SkysLastChance
      I am trying to type a name in patient summary search box. How should I go about doing this. I am clearly not doing it right. (Attached Picture of HTML code.)
      This is what I have tried. I assume this is not working because it is not a form? 
      WinActivate("MEDITECH - Internet Explorer")       Sleep (500)    $oIE = _IEAttach("MEDITECH")    $oForm = _IEFormGetObjByName($oIE, "systemMenu")    $oText = _IEFormElementGetObjByName($oForm, "sysmenu-searchbarinput") _IEFormElementSetValue($oText, "Hey! This works!")
    • aiter
      By aiter
      Just want to report a warning I get when using IE udf and running from F5 in scite

      -> IE.au3 T3.0-2 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
      When I look at IE.au3 I see a comment that this function has been removed as there are no more fatal errors.
       
    • aiter
      By aiter
      I created a webpage using the IE udf. Great, but then I noticed I cannot do a ctrl-F to find something on the page. 
      If I save the page then bring that page up I can find things of course.
      Its trivial really, but is there way to get the ctrl-F to work when the page is generated without resorting to having to save?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.