WildCrosssing 0 Report post Posted November 24, 2006 Ok, sometime, I have some error with COM object and when it happens, my autoit crash. How can I make silent error? If the COM object failed, it runs the line below without terminate the script and say an error message. How? Thanks. Share this post Link to post Share on other sites
PsaltyDS 27 Report post Posted November 24, 2006 Ok, sometime, I have some error with COM object and when it happens, my autoit crash. How can I make silent error? If the COM object failed, it runs the line below without terminate the script and say an error message. How? Thanks. When your script throws a COM error, you must have already defined a function to handle it. Read the Obj/COM Reference section of the help file, especialy down at the subsection titled "COM Error Handling". With help from several smarter people than me on this forum, I have settled on the following: $oComError = ObjEvent("AutoIt.Error","_ComErrFunc") ; Install a custom error handler ; The rest of your script, which may throw COM errors... ;-------------------------------------- ; Function _ComErrFunc() ; Custom COM object error handler ;-------------------------------------- Func _ComErrFunc() Local $HexNumber = Hex($oComError.number, 8) MsgBox(16, "AutoIT COM Error", "AutoIT COM Error Occured!" & @CRLF & _ @TAB & "Error Number: " & $HexNumber & @CRLF & _ @TAB & "Line Number: " & $oComError.scriptline & @CRLF & _ @TAB & "Description: " & $oComError.description & @CRLF & _ @TAB & "WinDescription: " & $oComError.windescription) SetError(1); something to check for when this function returns EndFunc ;==>_ComErrFunc Hope that helps. 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 Share this post Link to post Share on other sites