Jump to content

IE.au3 Error


GMib
 Share

Recommended Posts

Hi, i search for several day why i've this error :

C:\Program Files\AutoIt3\Include\IE.au3 (3754) : ==> Variable must be of type "Object".:
$IEComErrorScriptline = $oIEErrorHandler.scriptline
$IEComErrorScriptline = $oIEErrorHandler^ ERROR

The code :

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <IE.au3>
Global $editsyn,$htmlfilter

creategui()
Func creategui()
    Opt("GUIOnEventMode", 1)
    $form1 = GUICreate("Vidz", 715, 207, 500, 500, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOOLWINDOW)
    $editsyn = _IECreateEmbedded()
    $hCtrl = GUICtrlCreateObj($editsyn, 0, 0, 715, 207)
    _IENavigate ($editsyn, "about:Synopsis")
    GUISetState(@SW_SHOW)
    While 1
        disp()
        Sleep(1000)
    WEnd
EndFunc   ;==>creategui

Func disp()
    $line = '<head><style type="text/css">' & _
    'body {height:200px;width:690px;margin:0;padding:0;} html {margin:0;padding:0;} #imagette img {height:196px;margin-top:1px;margin-left:1px;float:left;border:1px solid black;margin-right:3px;} .left{float:left;}' & _
    '.right {margin:0;padding:0;float:right;text-align:right;} #header {margin-bottom:5px;} #annee {font-size:120%;font-weight:bold;margin-right:5px;} #titre {font-weight: bold; } #synopsis {font-size:80%;} </style>' & _
    '</head><body><div id="imagette"><a href="pickclick|[image]"><img src="[image]"/></a></div><div id="header"><div class="right"><div>[rea]</div><div><a href="rechfilm">Rech Film</a> - <a href="rechinfo">Rech info</a></div></div>' & _
    '<div id="titregen"><span id="annee">[annee]</span><span id="titre"><a href="titreclick">[titre]</a></span></div><div id="genre">[genre]</div></div><div id="synopsis">[synopsis]</div></body></html>'
    _IEDocWriteHTML($editsyn, $line)
    _IEAction ($editsyn, "refresh")
    $oLinks = _IELinkGetCollection($editsyn)
    For $oLink in $oLinks
        $sLinkId = _IEPropertyGet($oLink, "uniqueid")
        _IEHeadInsertEventScript($editsyn, $sLinkId, "onclick", "return false;")
        ObjEvent($oLink, "_Evt_")
    Next
EndFunc   ;==>disp

Func _Evt_onclick()
    Local $o_link = @COM_EventObj
    Select
        Case StringInStr($o_link.href,'about:pickclick|')
            test($o_link.href)
    EndSelect
EndFunc

Func test($link)
    $oIE = _IECreate ("http://www.autoitscript.com/")
    _IEDocWriteHTML ($oIE, "about:blank")
    _IEAction ($oIE, "refresh")
EndFunc

Error occur when i use IE.au3 function in auther function than disp(), with any function (_IECreate, _IEDocWriteHTML etc...)

if i move the test() instruction in disp() i'v not error.

Sorry for my bad english.

Link to comment
Share on other sites

Start by adding _IEErrorHandlerRegister() right after you include IE.au3. This doesn't avoid the error, but it does make it non-fatal. If your program execution is unaffected by the error, you can also add _IEErrorNotify(False) to supress the output to the console.

The COM error handling in AutoIt is quite limited due to the way it is implemented (allowing only one, managed by a global variable). IE.au3 works hard to use an internal error COM error handler and still allow you to instantiate your own. The asynchronous code paths using event routines can cause some timing issues with the way IE.au3 registers and deregisters its internal handler.

I suspect the workaround I gave you will solve your problem until someday when the AutoIt COM error handling is improved. If you want to look into it more deeply, I suggest you open IE.au3 and look at the implementation in __IEInternalErrorHandlerRegister() and related functions.

Dale

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

Why do you pass $link in the test function if you never use it ?

this code is a light code, in real code i use (and i need) $link

Start by adding _IEErrorHandlerRegister() right after you include IE.au3. This doesn't avoid the error, but it does make it non-fatal.

Dale

it's strange i already tested this and autoit crashed also with _IEErrorHandlerRegister(), i've test again and now it's work (i've error but no crash)

Thx

Edited by GMib
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...