Jump to content
Sign in to follow this  
nitekram

IE.au3

Recommended Posts

nitekram

I use the following to get errors and to stop my script from freezing...

Global $sDebugFile = 'COMError_Debug.txt'

_COMError_Notify(2)


Func _COMError_Notify($iDebug, $sDebugFile = Default)
    Static Local $avDebugState[3] = [0, "", 0] ; Debugstate, Debugfile and AutoIt.Error object
    ;If $sDebugFile = Default Or $sDebugFile = "" Then $sDebugFile = '\\cscsvrndc001\users\mthompson49\shared\COMError_Debug.txt'
    If Not IsInt($iDebug) Or $iDebug < -1 Or $iDebug > 3 Then Return SetError(1, 0, 0)
    Switch $iDebug
        Case -1
            Return $avDebugState
        Case 0
            $avDebugState[0] = 0
            $avDebugState[1] = ""
            $avDebugState[2] = 0
        Case Else
            If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
            ; A COM error handler will be initialized only if one does not exist
            If ObjEvent("AutoIt.Error") = "" Then
                $avDebugState[2] = ObjEvent("AutoIt.Error", "__COMError_Handler") ; Creates a custom error handler
                If @error <> 0 Then Return SetError(2, @error, 0)
                $avDebugState[0] = $iDebug
                $avDebugState[1] = $sDebugFile
                Return SetError(0, 1, 1)
            ElseIf ObjEvent("AutoIt.Error") = "__COMError_Handler" Then
                Return SetError(0, 0, 1) ; COM error handler already set by a previous call to this function
            Else
                Return SetError(3, 0, 0) ; COM error handler already set to another function
            EndIf
    EndSwitch
    Return

EndFunc   ;==>_COMError_Notify

Func __COMError_Handler($oCOMError)
    Local $sTitle = "AutoIt COM error handler", $file
    Local $avDebugState = _COMError_Notify(-1)
    Local $sError = "Error encountered in " & @ScriptName & ":" & @CRLF & _
            "  @AutoItVersion = " & @AutoItVersion & @CRLF & _
            "  @AutoItX64 = " & @AutoItX64 & @CRLF & _
            "  @Compiled = " & @Compiled & @CRLF & _
            "  @OSArch = " & @OSArch & @CRLF & _
            "  @OSVersion = " & @OSVersion & @CRLF & _
            "  Scriptline = " & $oCOMError.Scriptline & @CRLF & _
            "  NumberHex = " & Hex($oCOMError.Number, 8) & @CRLF & _
            "  Number = " & $oCOMError.Number & @CRLF & _
            "  WinDescription = " & StringStripWS($oCOMError.WinDescription, 2) & @CRLF & _
            "  Description = " & StringStripWS($oCOMError.Description, 2) & @CRLF & _
            "  Source = " & $oCOMError.Source & @CRLF & _
            "  HelpFile = " & $oCOMError.HelpFile & @CRLF & _
            "  HelpContext = " & $oCOMError.HelpContext & @CRLF & _
            "  LastDllError = " & $oCOMError.LastDllError & @CRLF

    If '183' = $oCOMError.LastDllError Then Return

    Switch $avDebugState[0]
        Case 1
            ;MsgBox(64, $sTitle & '1', $sError)
            ConsoleWrite($sTitle & " mwt-mwt " & $sError & @CRLF)
            $file = FileOpen($sDebugFile, 1)
            FileWrite($sDebugFile, 'ERROR 1 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                    " - " & $sError & @CRLF & @CRLF)
            FileClose($file)
        Case 2
            ;MsgBox(64, $sTitle & '2', $sError)
            If StringStripWS($oCOMError.WinDescription, 2) <> 'The RPC server is unavailable.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'The object invoked has disconnected from its clients.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'Unspecified error' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'Unable to set the Calculation property of the Application class' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'No such interface supported' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'The interface is unknown.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> "Variable is not of type 'Object'." _
                    And Not StringInStr($sError, 'Unable to set the Calculation property of the Application class') Then
                $file = FileOpen($sDebugFile, 1)
                ConsoleWrite($sTitle & @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                        " - " & $sError)
                FileWrite($sDebugFile, 'ERROR 2 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                        " - " & $sError & @CRLF & @CRLF)
                FileClose($file)
            EndIf
        Case 3
            ;MsgBox(64, $sTitle & '3', $sError)
            $file = FileOpen($sDebugFile, 1)
            FileWrite($sDebugFile, 'ERROR 3 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                    " - " & $sError & @CRLF & @CRLF)
            FileClose($file)
    EndSwitch

EndFunc   ;==>__COMError_Handler

Can someone suggest a way to get rid of these two errors that are hitting the console...script stops processing until they hit like 20 times

--> 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)
--> 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)
 

EDIT - spelling

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
mLipok

focus on that:

If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
nitekram

I changed my code to this:

Global $sDebugFile = 'COMError_Debug.txt'

_COMError_Notify(2)

Func _COMError_Notify($iDebug, $sDebugFile = Default)
    Static Local $avDebugState[3] = [0, "", 0] ; Debugstate, Debugfile and AutoIt.Error object
    ;If $sDebugFile = Default Or $sDebugFile = "" Then $sDebugFile = '\\cscsvrndc001\users\mthompson49\shared\COMError_Debug.txt'
    If Not IsInt($iDebug) Or $iDebug < -1 Or $iDebug > 3 Then Return SetError(1, 0, 0)
    ;http://www.autoitscript.com/forum/topic/155991-ieau3/
    ; If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
    If ($iDebug = -1 Or $iDebug = 2) And ($sDebugFile = "" And $sDebugFile <> Default) Then Return SetError(4, 0, 0)
    ConsoleWrite('$iDebug ' & $iDebug & @CRLF)
ConsoleWrite('$sDebugFile ' & $sDebugFile & @CRLF)

    Switch $iDebug
        Case -1
            Return $avDebugState
        Case 0
            $avDebugState[0] = 0
            $avDebugState[1] = ""
            $avDebugState[2] = 0
        Case Else
            If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
            ; A COM error handler will be initialized only if one does not exist
            If ObjEvent("AutoIt.Error") = "" Then
                $avDebugState[2] = ObjEvent("AutoIt.Error", "__COMError_Handler") ; Creates a custom error handler
                If @error <> 0 Then Return SetError(2, @error, 0)
                $avDebugState[0] = $iDebug
                $avDebugState[1] = $sDebugFile
                Return SetError(0, 1, 1)
            ElseIf ObjEvent("AutoIt.Error") = "__COMError_Handler" Then
                Return SetError(0, 0, 1) ; COM error handler already set by a previous call to this function
            Else
                Return SetError(3, 0, 0) ; COM error handler already set to another function
            EndIf
    EndSwitch
    Return

EndFunc   ;==>_COMError_Notify

Func __COMError_Handler($oCOMError)
    Local $sTitle = "AutoIt COM error handler", $file
    Local $avDebugState = _COMError_Notify(-1)
    Local $sError = "Error encountered in " & @ScriptName & ":" & @CRLF & _
            "  @AutoItVersion = " & @AutoItVersion & @CRLF & _
            "  @AutoItX64 = " & @AutoItX64 & @CRLF & _
            "  @Compiled = " & @Compiled & @CRLF & _
            "  @OSArch = " & @OSArch & @CRLF & _
            "  @OSVersion = " & @OSVersion & @CRLF & _
            "  Scriptline = " & $oCOMError.Scriptline & @CRLF & _
            "  NumberHex = " & Hex($oCOMError.Number, 8) & @CRLF & _
            "  Number = " & $oCOMError.Number & @CRLF & _
            "  WinDescription = " & StringStripWS($oCOMError.WinDescription, 2) & @CRLF & _
            "  Description = " & StringStripWS($oCOMError.Description, 2) & @CRLF & _
            "  Source = " & $oCOMError.Source & @CRLF & _
            "  HelpFile = " & $oCOMError.HelpFile & @CRLF & _
            "  HelpContext = " & $oCOMError.HelpContext & @CRLF & _
            "  LastDllError = " & $oCOMError.LastDllError & @CRLF

    If '183' = $oCOMError.LastDllError Then Return

    Switch $avDebugState[0]
        Case 1
            ;MsgBox(64, $sTitle & '1', $sError)
            ConsoleWrite($sTitle & " mwt-mwt " & $sError & @CRLF)
            $file = FileOpen($sDebugFile, 1)
            FileWrite($sDebugFile, 'ERROR 1 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                    " - " & $sError & @CRLF & @CRLF)
            FileClose($file)
        Case 2
            ;MsgBox(64, $sTitle & '2', $sError)
            If StringStripWS($oCOMError.WinDescription, 2) <> 'The RPC server is unavailable.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'The object invoked has disconnected from its clients.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'Unspecified error' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'Unable to set the Calculation property of the Application class' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'No such interface supported' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> 'The interface is unknown.' _
                    And StringStripWS($oCOMError.WinDescription, 2) <> "Variable is not of type 'Object'." _
                    And Not StringInStr($sError, 'Unable to set the Calculation property of the Application class') Then
                $file = FileOpen($sDebugFile, 1)
                ConsoleWrite($sTitle & @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                        " - " & $sError)
                FileWrite($sDebugFile, 'ERROR 2 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                        " - " & $sError & @CRLF & @CRLF)
                FileClose($file)
            EndIf
        Case 3
            ;MsgBox(64, $sTitle & '3', $sError)
            $file = FileOpen($sDebugFile, 1)
            FileWrite($sDebugFile, 'ERROR 3 USER ' & @UserName & '   ' & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & $sTitle & _
                    " - " & $sError & @CRLF & @CRLF)
            FileClose($file)
    EndSwitch

EndFunc   ;==>__COMError_Handler

Still getting this:

$iDebug -1
$sDebugFile Default
--> 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)
--> 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 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 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 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 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 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 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 internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
$iDebug -1
$sDebugFile Default
--> IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
mLipok

this  $sDebugFile

Global $sDebugFile = 'COMError_Debug.txt'
_COMError_Notify(2)

is not the same with this $sDebugFile:

Func _COMError_Notify($iDebug, $sDebugFile = Default)

first one is Global $sDebugFile

second one is Local $sDebugFile

try this:

Global $sDebugFile = 'COMError_Debug.txt'
_COMError_Notify(2,$sDebugFile)

edit:

this is better:

Global $sDebugFile = @ScriptDir & '\COMError_Debug.txt'
_COMError_Notify(2,$sDebugFile)
Edited by mlipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
lionfaggot

error handling can be a pita, im not sure where your issue is there but id be willing to give the script a shot. on a side note, my example functions for ie are pretty dope. you should have a look, they do many of the things people would want to do with ie in only two functions. check it if you want: '?do=embed' frameborder='0' data-embedContent>>

Share this post


Link to post
Share on other sites
nitekram

I did change the call - added the path to it, but still getting the same issue.

I found another post that says: to read the doc for _IEErrorHandlerRegister(), but have no clue...as you were the one that asked the question, did you ever use this function?

EDIT added this from the description of the function:

; #FUNCTION# ====================================================================================================================
; Name...........: _IEErrorHandlerRegister
; Description ...: Register and enable a user COM error handler
; Parameters ....: $s_functionName - String variable with the name of a user-defined COM error handler
;           defaults to the internal COM error handler in this UDF
; Return values .: On Success  - Returns 1
;                  On Failure - Returns 0 and sets @ERROR
;     @ERROR  - 0 ($_IEStatus_Success) = No Error
;        - 1 ($_IEStatus_GeneralError) = General Error
;     @Extended - Contains invalid parameter number
; Author ........: Dale Hohm

Func _IEErrorHandlerRegister($s_functionName = "__IEInternalErrorHandler")
 $sIEUserErrorHandler = $s_functionName
 $oIEErrorHandler = ""
 $oIEErrorHandler = ObjEvent("AutoIt.Error", $s_functionName)
 If IsObj($oIEErrorHandler) Then
  Return SetError($_IEStatus_Success, 0, 1)
 Else
  __IEErrorNotify("Error", "_IEPropertySet", "$_IEStatus_GeneralError", _
    "Error Handler Not Registered - Check existance of error function")
  Return SetError($_IEStatus_GeneralError, 1, 0)
 EndIf
EndFunc   ;==>_IEErrorHandlerRegister

Here is the post...

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
DaleHohm

What don't you understand about _IEErrorHandlerRegister?

Simply use it in place of your call to ObjEvent and pass the name of your error handler function.

Upgrade to the beta of AutoIt and it is no longer required since COM errors are no longer fatal and IE.au3 no longer needs to manage an internal error handler.

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

Share this post


Link to post
Share on other sites
nitekram

What don't you understand about _IEErrorHandlerRegister?

Simply use it in place of your call to ObjEvent and pass the name of your error handler function.

The only place in my script that uses the ObjEvent is here:

Func _COMError_Notify($iDebug, $sDebugFile = Default)
    Static Local $avDebugState[3] = [0, "", 0] ; Debugstate, Debugfile and AutoIt.Error object
    ;If $sDebugFile = Default Or $sDebugFile = "" Then $sDebugFile = '\\cscsvrndc001\users\mthompson49\shared\COMError_Debug.txt'
    If Not IsInt($iDebug) Or $iDebug < -1 Or $iDebug > 3 Then Return SetError(1, 0, 0)
    ;http://www.autoitscript.com/forum/topic/155991-ieau3/
    ; If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
    If ($iDebug = -1 Or $iDebug = 2) And ($sDebugFile = "" And $sDebugFile <> Default) Then Return SetError(4, 0, 0)
    ConsoleWrite('$iDebug ' & $iDebug & @CRLF)
ConsoleWrite('$sDebugFile ' & $sDebugFile & @CRLF)

    Switch $iDebug
        Case -1
            Return $avDebugState
        Case 0
            $avDebugState[0] = 0
            $avDebugState[1] = ""
            $avDebugState[2] = 0
        Case Else
            If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
            ; A COM error handler will be initialized only if one does not exist
            If ObjEvent("AutoIt.Error") = "" Then
                $avDebugState[2] = ObjEvent("AutoIt.Error", "__COMError_Handler") ; Creates a custom error handler
                If @error <> 0 Then Return SetError(2, @error, 0)
                $avDebugState[0] = $iDebug
                $avDebugState[1] = $sDebugFile
                Return SetError(0, 1, 1)
            ElseIf ObjEvent("AutoIt.Error") = "__COMError_Handler" Then
                Return SetError(0, 0, 1) ; COM error handler already set by a previous call to this function
            Else
                Return SetError(3, 0, 0) ; COM error handler already set to another function
            EndIf
    EndSwitch
    Return

EndFunc   ;==>_COMError_Notify
When I replace the calls, I get an error that states that I am calling your function with the wrong amount of arguments? Can you explain - where and how I would use your function _IEErrorHandlerRegister()- sorry if I do not understand.

Upgrade to the beta of AutoIt and it is no longer required since COM errors are no longer fatal and IE.au3 no longer needs to manage an internal error handler.

At work and not able to upgrade to the newest and greatest, so that is not an option at this time.

Thanks for any help that you might be able to provide!!!


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
DaleHohm

It takes one (optional) parameter.  What are you passing?  You've looked at the example in the helpfile, right?

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

Share this post


Link to post
Share on other sites
nitekram

Func _COMError_Notify($iDebug, $sDebugFile = Default)
    Static Local $avDebugState[3] = [0, "", 0] ; Debugstate, Debugfile and AutoIt.Error object
    ;If $sDebugFile = Default Or $sDebugFile = "" Then $sDebugFile = '\\cscsvrndc001\users\mthompson49\shared\COMError_Debug.txt'
    If Not IsInt($iDebug) Or $iDebug < -1 Or $iDebug > 3 Then Return SetError(1, 0, 0)
    ;http://www.autoitscript.com/forum/topic/155991-ieau3/
    ; If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
    If ($iDebug = -1 Or $iDebug = 2) And ($sDebugFile = "" And $sDebugFile <> Default) Then Return SetError(4, 0, 0)
    ConsoleWrite('$iDebug ' & $iDebug & @CRLF)
ConsoleWrite('$sDebugFile ' & $sDebugFile & @CRLF)

    Switch $iDebug
        Case -1
            Return $avDebugState
        Case 0
            $avDebugState[0] = 0
            $avDebugState[1] = ""
            $avDebugState[2] = 0
        Case Else
            If $iDebug = 2 And $sDebugFile = "" Then Return SetError(4, 0, 0)
            ; A COM error handler will be initialized only if one does not exist

            ;http://www.autoitscript.com/forum/topic/155991-ieau3/#entry1127806
            #cs
            What don't you understand about _IEErrorHandlerRegister?

Simply use it in place of your call to ObjEvent and pass the name of your error handler function.

Upgrade to the beta of AutoIt and it is no longer required since COM errors are no longer fatal and IE.au3 no longer needs to manage an internal error handler.
#ce



        If _IEErrorHandlerRegister("AutoIt.Error") = "" Then  ; HERE

            ;If ObjEvent("AutoIt.Error") = "" Then
                ;$avDebugState[2] = ObjEvent("AutoIt.Error", "__COMError_Handler") ; Creates a custom error handler
                $avDebugState[2] = _IEErrorHandlerRegister("AutoIt.Error", "__COMError_Handler")  ; HERE

                If @error <> 0 Then Return SetError(2, @error, 0)
                $avDebugState[0] = $iDebug
                $avDebugState[1] = $sDebugFile
                Return SetError(0, 1, 1)
            ;ElseIf ObjEvent("AutoIt.Error") = "__COMError_Handler" Then
                ElseIf _IEErrorHandlerRegister("AutoIt.Error") = "__COMError_Handler" Then  ; HERE
                Return SetError(0, 0, 1) ; COM error handler already set by a previous call to this function
            Else
                Return SetError(3, 0, 0) ; COM error handler already set to another function
            EndIf
    EndSwitch
    Return

EndFunc   ;==>_COMError_Notify

Sorry, if I misunderstood what you said, but thought you just wanted me to use that function where I call the ObjEvent?

EDIT As far as looking in the help file - I am now

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
nitekram

OK, after reading the help file part for this...still not sure what it does? Anyway, I no longer am getting the error messages, that I received before, and it appears to have done the trick.

All I did was call your example in the beginning of my script - I never DeRegister, should register it right before using the IE.au3 functions and then De-register it right after my commands are complete?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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  

×