Nomad_RJ

COM Error Handling broke on Autoit v3.3.14.2

8 posts in this topic

Dear colleagues,

I´ve been using the COM extensions for a while in AutoIt v3.3.8.1 with success. My ErrFunc is exactly as the example in this page: https://www.autoitscript.com/autoit3/docs/intro/ComRef.htm , except that my script write the output to a log file instead of showing an error window.

I have compiled the exact same code with the two AutoIt versions to test. On v3.3.8.1 I have the following error output from ErrFunc in a particular situation: 
[COMerror;00000002;Not an Object type]

Compiling with v3.3.14.2 and running the same particular situation stated above, I have a crash with the message "The requested action with this object has failed".


I haven´t found any script breaking change related to this problem on the help file for the newest versions since 3.3.8. Anyone have any clue about this problem?

Thanks in advance!
Nomad_RJ

 

 

Share this post


Link to post
Share on other sites



Welcome to the forum.
Beetwen 3.3.8.1 and 3.3.14.2 in AutoIt internaly there was many changes in COM Objects behavior/handling.

Which kind of object you are using ?
Which UDF you are using ?
Can you show a script line which invokes this error ?


Wondering who uses AutoIT and what it can be used for ?


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

Last update: 2017-05-23
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 SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF * GitHub API UDF - modest begining *

My contribution to others projects: * _sql.au3 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 * Best coding practices * 

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."

 

Share this post


Link to post
Share on other sites

Thanks mLipok!

Sure I can share a piece of the code with you. I´m using the Lotus Notes (8.5) COM to handle notes databases (NSF files), mainly mail databases, but Lotus Notes have many different types of databases, like names.nsf (personal address book), log files, applications, and much more, each one with a different structure. Thats why the COM error catching is so important to me: althought I´m working on email databases, I expect, from time to time, a different database being provided, even if I can´t process it, I just log the error and keep working.

Here is a sample of my code:

Global $iEventError = 0 ; To be checked to know if COM error occurs. Must be reset after handling.
Global $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler

$inifile = GUICtrlRead($clientpath)&"notes.ini"
IniWrite($inifile,"NOTES","KeyFilename",$userid)
$Session = ObjCreate("Lotus.NotesSession")      ;Starts a Notes Session in background
$pwd = FileReadLine($userpw, 1)
$Session.Initialize($pwd)
If $iEventError Then
    _SaveLog($LogFile, "Erro ao inicializar a sessão com o Lotus Notes ($Session.Initialize). Possível erro de senha do ID. " & @CRLF)
    $iEventError = 0 ; Reset after displaying a COM Error occurred
    Return 69
EndIf
$Maildb = $Session.GETDATABASE("", $file)
If $iEventError Then
    _SaveLog($LogFile, "Erro ao abrir o arquivo NSF ($Session.GETDATABASE). Arquivo corrompido ou com problemas na estrutura. "& @CRLF)
    $iEventError = 0 ; Reset after displaying a COM Error occurred
    Return 69
EndIf
$UserName = $Session.UserName   
$folder = $Maildb.GetView('$All')
If $iEventError Then
    _SaveLog($LogFile, "Erro ao abrir o arquivo NSF ($Session.GETVIEW). Arquivo corrompido ou com problemas na estrutura. "& @CRLF)
    $iEventError = 0 ; Reset after displaying a COM Error occurred
    Return 69
EndIf
$doc = $folder.GetFirstDocument()   ;==== HERE IS WHERE v3.3.8.1 CATCHES THE ERROR, BUT v3.3.14.2 CRASHES ====
If $iEventError Then
    _SaveLog($LogFile, "Erro ao abrir o arquivo NSF ($Session.GetFirstDoc). Arquivo corrompido ou com problemas na estrutura. "& @CRLF)
    $iEventError = 0 ; Reset after displaying a COM Error occurred
    Return 69
EndIf


Func ErrFunc() ;COM Error intercepted
   $sHexNumber = Hex($oMyError.number, 8)
   _SaveLog($LogFile, "[COMerror;" & $sHexNumber &";"& $oMyError.windescription &"]"&@CRLF)
   $iEventError = 1 ; Use to check when a COM Error occurs
EndFunc   ;==>ErrFunc

 

I know that "$doc = $folder.GetFirstDocument()" will not work on all structures, but I don´t want the script to crash when that happens.

Thanks for your help!

 

Share this post


Link to post
Share on other sites

What you get from: 

$oMyError.windescription
; and 
$oMyError.description

??


Wondering who uses AutoIT and what it can be used for ?


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

Last update: 2017-05-23
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 SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF * GitHub API UDF - modest begining *

My contribution to others projects: * _sql.au3 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 * Best coding practices * 

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."

 

Share this post


Link to post
Share on other sites

When the script is compiled with v3.3.8.1: $oMyError.windescription = "Not an Object type"

When the script is compiled with v3.3.14.2: AutoIt closes with a message window "The requested action with this object has failed" (the ErrFunc don´t even is called)

Share this post


Link to post
Share on other sites
$folder = $Maildb.GetView('$All')
; change this following line
; If $iEventError Then

; to this:
If $iEventError or (NOT IsObj($folder)) Then

 


Wondering who uses AutoIT and what it can be used for ?


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

Last update: 2017-05-23
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 SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF * GitHub API UDF - modest begining *

My contribution to others projects: * _sql.au3 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 * Best coding practices * 

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."

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

10 minutes ago, Nomad_RJ said:

(the ErrFunc don´t even is called)

This is know bug in Au3.3.14.x (already reported to the TrackTicket).
EDIT: You can make a workaround (I show you in previous post how to do it), back to Au3.3.12.x or wait for new release or beta .

Edited by mLipok

Wondering who uses AutoIT and what it can be used for ?


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

Last update: 2017-05-23
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 SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF * GitHub API UDF - modest begining *

My contribution to others projects: * _sql.au3 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 * Best coding practices * 

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."

 

Share this post


Link to post
Share on other sites

Good to know the bug is being tracked.

Nice strategy with IsObj()! That worked for me. Thanks for your time and attention! :thumbsup:

 

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