Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_IECreat() error


  • Please log in to reply
12 replies to this topic

#1 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 19 February 2009 - 02:06 AM

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?







#2 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,199 posts

Posted 19 February 2009 - 02:56 AM

Worked for me

#include <IE.au3> _IECreate("www.google.com",0 , 1 , 1, 0)


I will bet you are running Vista.. there are some answer to "specific" Vista problems with IE.au3. see Dale's post

8)

Posted Image

Clic The Pic!!!


#3 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 19 February 2009 - 03:16 AM

[quote name='Valuater' post='646333' date='Feb 18 2009, 06:56 PM']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.)

#4 Authenticity

Authenticity

    Universalist

  • MVPs
  • 2,619 posts

Posted 19 February 2009 - 03:21 AM

Maybe this will help you.

Edit: What is your IE.au3 version?

Edited by Authenticity, 19 February 2009 - 03:54 AM.


#5 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 19 February 2009 - 04:04 AM

Maybe this will help you.

Edit: What is your IE.au3 version?

Thanks, I will look at it.
BTW, my IE.au3 version is V2.4-1.

#6 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 19 February 2009 - 02:05 PM

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

#7 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 24 February 2009 - 09:07 AM

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


#8 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 24 February 2009 - 02:29 PM

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

#9 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 25 February 2009 - 01:43 AM

My _XMLDomWrapper.au3 is the newest. the following is the whole code.
Plain Text         
#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:
Plain Text         
<?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.

#10 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 25 February 2009 - 07:54 PM

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:
Plain Text         
#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, 25 February 2009 - 08:48 PM.

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

#11 DaleHohm

DaleHohm

    Think of IE as an API...

  • MVPs
  • 5,976 posts

Posted 25 February 2009 - 10:14 PM

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, 26 February 2009 - 02:01 AM.

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


#12 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 25 February 2009 - 10:52 PM

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, 25 February 2009 - 11:06 PM.

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

#13 leevy

leevy

    Seeker

  • Active Members
  • 38 posts

Posted 27 February 2009 - 07:29 AM

Thank everyone for advice. I will try to solve it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users