Jump to content

_IECreat() error


leevy
 Share

Recommended Posts

Hi,

In my script, a line'_IECreate("www.google.com",0 , 1 , 1, 0)' will generate an error, please see the following for the error details:

COM Error with DOM!

err.description is:

err.windescription: 未指定的错误

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 4257

err.source is:

err.helpfile is:

err.helpcontext is: 0

but if I replace '_IECreate("www.google.com",0 , 1 , 1, 0)' with '_IECreate("about:blank",0 , 1 , 1, 0)', the error will not appear.

anyone can help me?

Link to comment
Share on other sites

Worked for me

#include <IE.au3>

_IECreate("www.google.com",0 , 1 , 1, 0)oÝ÷ Ø"VÞ·*.j·«ºyâb²Ö­êÞj·¬¢gÌ®Ú*ºl¥ç"~'*ºUËZ¦ºé¬Â+a F®ÞÇ
©^ßÛ)¢Ë|þ«¨µä¨®¼¦Èä¾nº0±êâ±h§ÿ¸"»§jZ'{­Ø^~e£§+p¢¹,Áéejëh×6#include <IE.au3>

_IECreate("www.google.com",0 , 1 , 1, 0)

but deeper, I must read a xml file before I create an IE object. if so, I will get the above error. (understand me? sorry, my english is poor.)

Link to comment
Share on other sites

Thanks, I will look at it.

BTW, my IE.au3 version is V2.4-1.

And how are you reading this XML file? Please post a short reproducer script that causes the symptoms for you.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

And how are you reading this XML file? Please post a short reproducer script that causes the symptoms for you.

:)

here is my script:

Func _Readtemplate($xmlfilename,$path)
    $sXML = $xmlfilename    
    If _XMLFileOpen($sXML,"",-1) = -1 Then
        ConsoleWrite("can′t open file!" & @CRLF)
        Exit
    EndIf
    $tmpvalue = _XMLSelectNodes($path)
    $template = $tmpvalue[1]
    for $i = 2 to _ArrayMax($tmpvalue)
        $template =$template&"|"&$tmpvalue[$i]
    Next
EndFunc
Link to comment
Share on other sites

here is my script:

Func _Readtemplate($xmlfilename,$path)
    $sXML = $xmlfilename    
    If _XMLFileOpen($sXML,"",-1) = -1 Then
        ConsoleWrite("can′t open file!" & @CRLF)
        Exit
    EndIf
    $tmpvalue = _XMLSelectNodes($path)
    $template = $tmpvalue[1]
    for $i = 2 to _ArrayMax($tmpvalue)
        $template =$template&"|"&$tmpvalue[$i]
    Next
EndFunc
That's not enough for someone to run it and see your symptoms, but it does prompt a relevant question: Do you have the latest version of XMLDOMWrapper.au3 from eltorro? I believe he made some compatibility changes about a year ago, so his COM error handler would not conflict with others.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

My _XMLDomWrapper.au3 is the newest. the following is the whole code.

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include <_XMLDomWrapper.au3>
#include <GuiTab.au3>

Global $template, $tmpvalue 

_Main()
Func _Main()
; Create the GUI window and controls
    GUICreate("Wing 1.0", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)
    $OLD = _SetThemes(0)
    GUISetIcon("Wing_1.ico")

    $tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )
    _SetThemes($OLD)

;~  $tabitem1 = GUICtrlCreateTabItem("aaaa")    
;~  $create = GUICtrlCreateButton("Create file", 60, 465, 130, 20)
        
    $tabitem2 = GUICtrlCreateTabItem("bbbb")
    $radioAddreport = GUICtrlCreateRadio("Add bbbb", 25, 45, 160, 20, 000000)   
    $radioAddreporttemplate = GUICtrlCreateRadio("Add cccc", 200, 45, 150, 20, 000000)
    $bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)
    $bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)   
    $addreport = GUICtrlCreateButton("Add bbbb", 30, 465, 100, 20)
;~  $updatereport = GUICtrlCreateButton("Update bbbb", 150, 465, 90, 20)

;~  $tabitem1 = GUICtrlCreateTabItem("cccc")    

    GUICtrlCreateTabItem("")    
    $memonumlabel = GUICtrlCreateLabel("Memo #", 25, 75, 80, 20, 0x0200)
    $memonum = GUICtrlCreateInput("", 105, 75, 80, 20, 0x0080)
    $cancelbutton = GUICtrlCreateButton("Cancel", 260, 465, 60, 20)
    
;get bug report template
    _Readtemplate("data resource\resource.xml", "/wing/report/*")
    GUICtrlSetData($bugreporttemplate, $template,$tmpvalue[1])
    
; Run the GUI until it is closed
    GUISetState()
        ControlFocus ( "Wing 1.0", "", $memonum)
            
    While 1
        $msg = GUIGetMsg()          
            Select
                Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                    ExitLoop
                case $msg = $tab
                    if GUICtrlRead($tab) = 0 Then
                        $clickAddreport = ControlClick("Wing 1.0","",$radioAddreport)
                    endif
                Case $msg = $addreport
                    if GUICtrlRead($memonum) = "" Then
                        MsgBox(4096,"message","Please input memo number",10)
                    Else
                        $oIE = _IECreate("www.google.com")
                    EndIf
            EndSelect
    WEnd
    Exit
EndFunc  ;==>_Main

Func _Readtemplate($xmlfilename,$path)
    $sXML = $xmlfilename    
    If _XMLFileOpen($sXML,"",-1) = -1 Then
        ConsoleWrite("can′t open file!" & @CRLF)
        Exit
    EndIf
    $tmpvalue = _XMLSelectNodes($path)
    $template = $tmpvalue[1]
    for $i = 2 to _ArrayMax($tmpvalue)
        $template =$template&"|"&$tmpvalue[$i]
    Next
EndFunc

Func _SetThemes($Style)
    If @OSType = "WIN32_WINDOWS" Or $Style=-1 Then Return SetError(1,0,-1)
    Local $ret = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties")
    If Not IsArray($ret) Then Return SetError(1,0,-1)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $Style)
    Return $ret[0]
EndFunc

xml file contents is as the follows:

<?xml version="1.0" encoding="utf-8"?>
<wing>
  <report>
    <PSOreport>
      <bugreport>
        <title>title1</title>
        <sql>select .......</sql>
      </bugreport>
      <dashboard>
        <title>title2</title>
        <sql>select .......</sql>
      </dashboard>
    </PSOreport>
    <QAtemplate>
      <bugreport>
        <title>test title</title>
        <sql>test sql</sql>
      </bugreport>
      <dashboard>
        <title>test title 1</title>
        <sql>test sql 1</sql>
      </dashboard>
    </QAtemplate>
    <DEVtemplate>
      <bugreport>
        <title>test title 2</title>
        <sql>TEST SQL 2</sql>
      </bugreport>
      <dashboard>
        <title>test title 3</title>
        <sql>test sql 3</sql>
      </dashboard>
    </DEVtemplate>
  </report>
  <readme>
    <MM />
  </readme>
</wing>

I have no ideas now, hope your help, thanks.

Link to comment
Share on other sites

My _XMLDomWrapper.au3 is the newest. the following is the whole code.

CODE
#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Array.au3>

#include <IE.au3>

#include <_XMLDomWrapper.au3>

#include <GuiTab.au3>

Global $template, $tmpvalue

_Main()

Func _Main()

; Create the GUI window and controls

GUICreate("Wing 1.0", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2)

$OLD = _SetThemes(0)

GUISetIcon("Wing_1.ico")

$tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 )

_SetThemes($OLD)

;~ $tabitem1 = GUICtrlCreateTabItem("aaaa")

;~ $create = GUICtrlCreateButton("Create file", 60, 465, 130, 20)

$tabitem2 = GUICtrlCreateTabItem("bbbb")

$radioAddreport = GUICtrlCreateRadio("Add bbbb", 25, 45, 160, 20, 000000)

$radioAddreporttemplate = GUICtrlCreateRadio("Add cccc", 200, 45, 150, 20, 000000)

$bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200)

$bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20)

$addreport = GUICtrlCreateButton("Add bbbb", 30, 465, 100, 20)

;~ $updatereport = GUICtrlCreateButton("Update bbbb", 150, 465, 90, 20)

;~ $tabitem1 = GUICtrlCreateTabItem("cccc")

GUICtrlCreateTabItem("")

$memonumlabel = GUICtrlCreateLabel("Memo #", 25, 75, 80, 20, 0x0200)

$memonum = GUICtrlCreateInput("", 105, 75, 80, 20, 0x0080)

$cancelbutton = GUICtrlCreateButton("Cancel", 260, 465, 60, 20)

;get bug report template

_Readtemplate("data resource\resource.xml", "/wing/report/*")

GUICtrlSetData($bugreporttemplate, $template,$tmpvalue[1])

; Run the GUI until it is closed

GUISetState()

ControlFocus ( "Wing 1.0", "", $memonum)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

case $msg = $tab

if GUICtrlRead($tab) = 0 Then

$clickAddreport = ControlClick("Wing 1.0","",$radioAddreport)

endif

Case $msg = $addreport

if GUICtrlRead($memonum) = "" Then

MsgBox(4096,"message","Please input memo number",10)

Else

$oIE = _IECreate("www.google.com")

EndIf

EndSelect

WEnd

Exit

EndFunc ;==>_Main

Func _Readtemplate($xmlfilename,$path)

$sXML = $xmlfilename

If _XMLFileOpen($sXML,"",-1) = -1 Then

ConsoleWrite("can′t open file!" & @CRLF)

Exit

EndIf

$tmpvalue = _XMLSelectNodes($path)

$template = $tmpvalue[1]

for $i = 2 to _ArrayMax($tmpvalue)

$template =$template&"|"&$tmpvalue[$i]

Next

EndFunc

Func _SetThemes($Style)

If @OSType = "WIN32_WINDOWS" Or $Style=-1 Then Return SetError(1,0,-1)

Local $ret = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties")

If Not IsArray($ret) Then Return SetError(1,0,-1)

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $Style)

Return $ret[0]

EndFunc

xml file contents is as the follows:

CODE
<?xml version="1.0" encoding="utf-8"?>

<wing>

<report>

<PSOreport>

<bugreport>

<title>title1</title>

<sql>select .......</sql>

</bugreport>

<dashboard>

<title>title2</title>

<sql>select .......</sql>

</dashboard>

</PSOreport>

<QAtemplate>

<bugreport>

<title>test title</title>

<sql>test sql</sql>

</bugreport>

<dashboard>

<title>test title 1</title>

<sql>test sql 1</sql>

</dashboard>

</QAtemplate>

<DEVtemplate>

<bugreport>

<title>test title 2</title>

<sql>TEST SQL 2</sql>

</bugreport>

<dashboard>

<title>test title 3</title>

<sql>test sql 3</sql>

</dashboard>

</DEVtemplate>

</report>

<readme>

<MM />

</readme>

</wing>

I have no ideas now, hope your help, thanks.

I simplified the reproducer:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include <_XMLDomWrapper.au3>

; _IEErrorHandlerRegister; Uncomment this line to fix it

Global $template, $tmpvalue

; Create the GUI window and controls
GUICreate("Wing 1.0", 400, 500, (@DesktopWidth - 400) / 2, (@DesktopHeight - 500) / 2)
$addreport = GUICtrlCreateButton("Add bbbb", 30, 465, 100, 20)
$cancelbutton = GUICtrlCreateButton("Cancel", 260, 465, 60, 20)
GUISetState()

;Open XML, which loads _XMLCOMError() as the AutoIt COM error handler
If _XMLFileOpen(@ScriptDir & "\resource.xml", "", -1) = -1 Then
    ConsoleWrite("can't open file!" & @CRLF)
    Exit
EndIf

; Run the GUI until it is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            Exit
        Case $msg = $addreport
    ; Open IE with _IECreate() >> calls _IENavigate() >> calls __IEIsObjType() >> 
    ;   which fails running __IEInternalErrorHandlerRegister()
            $oIE = _IECreate("www.google.com")
    EndSelect
WEnd

This reproduces your error, and if you uncomment the _IEErrorHandlerRegister() it will fix it.

Your call to the XML functions registers an error handler from that UDF, then the IE UDF chokes on it. Dale might want to investigate, because I think IE.au3 is supposed to be OK with another error handler already registered.

:)

Edit: The console output running this demo is:

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\temp\Test.au3"  
--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 V2.4-0 Warning from function _IELoadWait, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

To clarify with the OP:

Hi,

In my script, a line'_IECreate("www.google.com",0 , 1 , 1, 0)' will generate an error, please see the following for the error details:

COM Error with DOM!

err.description is:

err.windescription:

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 4257

err.source is:

err.helpfile is:

err.helpcontext is: 0

but if I replace '_IECreate("www.google.com",0 , 1 , 1, 0)' with '_IECreate("about:blank",0 , 1 , 1, 0)', the error will not appear.

anyone can help me?

The COM error is referencing .scriptline = 4257 of IE.au3. Changing the URl to about:blank removes the internal call to _IENavigate() and avoids the issue.

Putting _IEErrorHandlerRegister() at the top of your script avoids the problem because the _XMLDOMWrapper() error handler is skipped if one is already loaded.

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Please note the exact text of the console message:

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType

I use the words Warning and Error very carefully. A warning can be often be ignored, but an Error will likely be a source of trouble.

_IENavigate calls _IELoadWait... _IELoad wait checks the readyState of the document object... we first check to insure it IS a document object... thus the call to __IEIsObjType... while doing a navigation, the current document object is destroyed, but we still attempt to check the document readyState. During the transition until a new document is instantiated, this causes a COM error. There is a lot of internal logic in IE.au3 to hide these expected errors from you and also to prevent them from being fatal.

Ok, so that is the source of the COM errors.

Now, the error handlers... only one COM error handler can be instantiated at a time. IE.au3 does the best it can to allow playing nice with others... it actually installs and deinstalls its internal COM error handler to try to stay out of the way of other code. If another COM error handler is being used, IE.au3 will remove it, install its own and then remove its own and reinstantiate yours... but, only if it can find it!

For IE.au3 to find your error handler, it must either be registered with _IEErrorHandlerRegister, or it must be assigned to the variable $oIEErrorHandler. In fact, if you modify eltorro's code and replace $oXMLMyError with $oIEErrorHandler, the IE.au3 warning and the _XML DOM errors will go away (because IE.au3 can then do the work behind the scenes of registering and deregistering error handlers).

This is exactly what is documented in the remarks for _IEErrorHandlerRegister() in the helpfile.

Dale

edit: clarity

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Please note the exact text of the console message:

--> IE.au3 V2.4-0 Warning from function internal function __IEIsObjType

I use the words Warning and Error very carefully. A warning can be often be ignored, but an Error will likely be a source of trouble.

_IENavigate calls _IELoadWait... _IELoad wait checks the readyState of the document object... we first check to insure it IS a document object... thus the call to __IEIsObjType... while doing a navigation, the current document object is destroyed, but we still attempt to check the document readyState. During the transition until a new document is instantiated, this causes a COM error. There is a lot of internal login in IE.au3 to hide these expected errors from you and also to prevent them from being fatal.

Ok, so that is the source of the COM errors.

Now, the error handlers... only one COM error handler can be instantiated at a time. IE.au3 does the best it can to allow playing nice with others... it actually installs and deinstalls its internal COM error handler to try to stay out of the way of other code. If another COM error handler is being used, IE.au3 will remove it, install its own and then remove its own and reinstantiate yours... but, only if it can find it!

For IE.au3 to find your error handler, it must either be registered with _IEErrorHandlerRegister, or it must be assigned to the variable $oIEErrorHandler. In fact, if you modify eltorro's code and replace $oXMLMyError with $oIEErrorHandler, the IE.au3 warning and the _XML DOM errors will go away (because IE.au3 can then do the work behind the scenes of registering and deregistering error handlers).

This is exactly what is documented in the remarks for _IEErrorHandlerRegister() in the helpfile.

Dale

edit: clarity

Seems like what we need is a standard, globaly declared, and universal variable (like $CmdLine or $CmdLineRaw are) for the current error handler. Then every UDF could reference it. A name like $COMErrorHandler would work. If everyone uses $oIEErrorHandler it works too, but the naming convention is not universal. Sounds like a feature request to me... though making it an accepted convention may be the only actual implementation.

:)

Edit: Opened it as a feature request Trac #838.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

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