maniootek Posted February 28, 2019 Share Posted February 28, 2019 (edited) I have very weird problem. Please check the screenshot: I am working on some object stored in variable called $oSubiekt. I perform some method on it with invaild values for test. Afther the method is called I receive the result stored in variable called $oProforma. Now, when I use VarGetType() function on the new variable $oProforma I receive result "Object" but IsObj() function return "0". So variable is object data type but in fact it is not object? Moreover, in this case my Com Error Handler does not catch the error. It says "The requested action with this object has failed." Is it normal? Edited: Is it possible to catch this kind of error by error handler? Edited February 28, 2019 by maniootek Link to comment Share on other sites More sharing options...
BrewManNH Posted February 28, 2019 Share Posted February 28, 2019 Where's your script? You've been here long enough to know that no one is going to be able to answer your question because you didn't post a script demonstrating the issue. Also, don't post screenshots of scripts, post the script. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
water Posted February 28, 2019 Share Posted February 28, 2019 Usually methods or properties are written in English. If this is true I sugest to try: $oSubiekt.Identificator BTW: Can you please post the code for the COM error handler you use? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 16 hours ago, BrewManNH said: Where's your script? You've been here long enough to know that no one is going to be able to answer your question because you didn't post a script demonstrating the issue. Also, don't post screenshots of scripts, post the script. I didn't post the code because you will not be able to test it on your side as it require to install some app to make this object work. I assumed that my screenshot is enough to show the problem. Anyway, this is the reproduced code: Example() Func Example() Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oInsertGT = ObjCreate("Insert.GT") $oInsertGT.Produkt = 1 ;1 = subiekt $oInsertGT.Wczytaj("C:\ProgramData\InsERT\InsERT GT\Subiekt.xml") Local $oSubiekt = $oInsertGT.Uruchom(0, 0) ConsoleWrite("VarGetType($oSubiekt)=" & VarGetType($oSubiekt) & ", IsObj($oSubiekt)=" & IsObj($oSubiekt) & @CRLF) Local $oProforma = $oSubiekt.Dokumenty.Wczytaj("this string suppose to be valid document number") ConsoleWrite("VarGetType($oProforma)=" & VarGetType($oProforma) & ", IsObj($oProforma)=" & IsObj($oProforma) & @CRLF) Local $oErrorHandlerTest $oErrorHandlerTest.Test ;Com error called with success (msgbox appeared with scripline number) $oProforma.Identyfikator ;Com error called with no success (msgbox with scriptline number not appeared) EndFunc ;==>Example Func _ErrFunc($oError) MsgBox(16, @ScriptName, "COM ERROR OCCURED! Check script line number " & $oError.ScriptLine) EndFunc ;==>_ErrFunc and console output: Quote ... --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop VarGetType($oSubiekt)=Object, IsObj($oSubiekt)=1 VarGetType($oProforma)=Object, IsObj($oProforma)=0 "C:\Example" (13) : ==> The requested action with this object has failed.: $oProforma.Identyfikator $oProforma^ ERROR ->12:14:18 AutoIt3.exe ended.rc:1 +>12:14:18 AutoIt3Wrapper Finished. >Exit code: 1 Time: 1.798 12 hours ago, water said: Usually methods or properties are written in English. In my case, all methods are called in my local polish language (this is how author of this app designed it) and they are correct. By the way, I found a solution to avoid this script breaking by checking if variable is object with IsObj() function. Now I am just curious why error handler does not catch this kind of error. Link to comment Share on other sites More sharing options...
water Posted March 1, 2019 Share Posted March 1, 2019 Maybe because the ErrorHandler is blocked by MsgBox. Could you please try: Func _ErrFunc($oError) ConsoleWrite("COM ERROR OCCURED! Check script line number " & $oError.ScriptLine & @CRLF) EndFunc ;==>_ErrFunc My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mLipok Posted March 1, 2019 Share Posted March 1, 2019 15 minutes ago, water said: Maybe because the ErrorHandler is blocked by MsgBox. I do not think so : 29 minutes ago, maniootek said: $oProforma.Identyfikator ;Com error called with no success (msgbox with scriptline number not appeared) @maniootek try this code: ....... ConsoleWrite("! VarGetType($oProforma) = " & VarGetType($oProforma) & @CRLF) ConsoleWrite("! ObjName($oProforma)=" & ObjName($oProforma) & @CRLF) $oProforma.Identyfikator ;Com error called with no success (msgbox with scriptline number not appeared) EndFunc ;==>Example What did you get in Console? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
water Posted March 1, 2019 Share Posted March 1, 2019 How does he know that it doesn’t get called as the only statement is the MsgBox? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 MsgBox() function in the error handler function has nothing to do with the problem I guess. 56 minutes ago, water said: Maybe because the ErrorHandler is blocked by MsgBox. Could you please try: Func _ErrFunc($oError) ConsoleWrite("COM ERROR OCCURED! Check script line number " & $oError.ScriptLine & @CRLF) EndFunc ;==>_ErrFunc Result is the same as before. Here is the console output: Quote ... --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop VarGetType($oSubiekt)=Object, IsObj($oSubiekt)=1 VarGetType($oProforma)=Object, IsObj($oProforma)=0 COM ERROR OCCURED! Check script line number 12 "C:\Example.au3" (13) : ==> The requested action with this object has failed.: $oProforma.Identyfikator $oProforma^ ERROR ->13:28:50 AutoIt3.exe ended.rc:1 +>13:28:50 AutoIt3Wrapper Finished. >Exit code: 1 Time: 0.7323 45 minutes ago, mLipok said: What did you get in Console? Quote ObjName($oSubiekt) = Subiekt ObjName($oProforma) = Link to comment Share on other sites More sharing options...
water Posted March 1, 2019 Share Posted March 1, 2019 I have created this reproducer script and it displays two MsgBoxes - works as designed and expected! Example() Func Example() Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oDictionary = ObjCreate("Scripting.Dictionary") Local $oErrorHandlerTest $oErrorHandlerTest.Test ; Com error called with success (msgbox appeared with scripline number) $oDictionary.Identyfikator ; Com error called with no success (msgbox with scriptline number not appeared) EndFunc ;==>Example Func _ErrFunc($oError) MsgBox(16, @ScriptName, "COM ERROR OCCURED! Check script line number " & $oError.ScriptLine) EndFunc ;==>_ErrFunc Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 8 minutes ago, water said: I have created this reproducer script and it displays two MsgBoxes - works as designed and expected! Your code also show me two MsgBoxes. 9 minutes ago, water said: Which version of AutoIt do you run? v3.3.14.5 I think my object (SUBIEKT) is special and is not fully compatible Link to comment Share on other sites More sharing options...
jchd Posted March 1, 2019 Share Posted March 1, 2019 (edited) Here's what I use to dump variables and, for your paticular concern, details about objects: Case "Object" $tmp = 'Object' & @LF & ' Name: ' & ObjName($vVar, $OBJ_NAME) $ret = ObjName($vVar, $OBJ_STRING) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' Description: ' & $ret $ret = ObjName($vVar, $OBJ_PROGID) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' ProgID: ' & $ret $ret = ObjName($vVar, $OBJ_FILE) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' Associated file: ' & $ret $ret = ObjName($vVar, $OBJ_MODULE) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' Owner/marshaller: ' & $ret $ret = ObjName($vVar, $OBJ_CLSID) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' CLSID: ' & $ret $ret = ObjName($vVar, $OBJ_IID) If Not @error Then $tmp &= @LF & $sMore & $sIndent & ' InterfaceID: ' & $ret Return $tmp $tmp is a string that accumulates out data, $vVar is the variable containing the object. Constants are from AutoItConstants.au3 Maybe this could give more info about the issue you encounter. Edited March 1, 2019 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 5 minutes ago, jchd said: Here's what I use to dump vairables and, in for tour paticular concern, details about objects: I tried your code but I just received empty Object name Link to comment Share on other sites More sharing options...
jchd Posted March 1, 2019 Share Posted March 1, 2019 So call that a ghost! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
mLipok Posted March 1, 2019 Share Posted March 1, 2019 (edited) 2 hours ago, maniootek said: I tried your code but I just received empty Object name to be sure that this is or not a ghost 👻 This is very interesting so, try this concept: expandcollapse popup#include <AutoItConstants.au3> ....... ....... ....... ....... ....... ObjName_FlagsValue($oProforma) $oProforma.Identyfikator ;Com error called with no success (msgbox with scriptline number not appeared) EndFunc ;==>Example Func ObjName_FlagsValue(ByRef $oObj) Local $sInfo = _ '-' & @TAB & "VarGetType($oObj) = " & VarGetType($oObj) & @CRLF & _ '-' & @TAB & "IsObj($oObj) = " & IsObj($oObj) & @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_NAME) {The name of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_NAME) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF ; HELPFILE REMARKS: Not all Objects support flags 2 to 7. Always test for @error in these cases. $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_STRING) {Description string of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_STRING) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_PROGID) {The ProgID of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_PROGID) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_FILE) {The file that is associated with the object in the Registry} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_FILE) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_MODULE) {Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_MODULE) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_CLSID) {CLSID of the object''s coclass} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_CLSID) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+' & @TAB & 'ObjName($oObj, $OBJ_IID) {IID of the object''s interface} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_IID) If @error Then $sInfo &= @CRLF & '!' & @TAB & '@error = ' & @error $sInfo &= @CRLF & @CRLF ConsoleWrite($sInfo & @CRLF) EndFunc ;==>ObjName_FlagsValue Edited March 1, 2019 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted March 1, 2019 Share Posted March 1, 2019 (edited) I was sure that this problem was asked before. A quick search and: You can also see this in my rewritten XML.au3 UDF Func _XML_SelectSingleNode(ByRef $oXmlDoc, $sXPath) ; Error handler, automatic cleanup at end of function Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) #forceref $oXML_COM_ErrorHandler __XML_IsValidObject_DOMDocumentOrElement($oXmlDoc) If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) Local $oNode_Selected = $oXmlDoc.selectSingleNode($sXPath) If @error Then Return SetError($XML_ERR_XPATH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) ElseIf $oNode_Selected = Null Then Return SetError($XML_ERR_NONODESMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) ElseIf Not IsObj($oNode_Selected) Then ; https://www.autoitscript.com/forum/topic/177176-why-isobj-0-and-vargettype-object/ ; $XML_ERR_EMPTYOBJECT Return SetError($XML_ERR_NONODESMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) EndIf Return SetError($XML_ERR_SUCCESS, $XML_EXT_DEFAULT, $oNode_Selected) EndFunc ;==>_XML_SelectSingleNode Edited March 1, 2019 by mLipok maniootek 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 51 minutes ago, mLipok said: This is very interesting so, try this concept: Quote ... - VarGetType($oObj) = Object - IsObj($oObj) = 0 + ObjName($oObj, $OBJ_NAME) {The name of the Object} = ! @error = 1 + ObjName($oObj, $OBJ_STRING) {Description string of the Object} = ! @error = 1 + ObjName($oObj, $OBJ_PROGID) {The ProgID of the Object} = ! @error = 1 + ObjName($oObj, $OBJ_FILE) {The file that is associated with the object in the Registry} = ! @error = 1 + ObjName($oObj, $OBJ_MODULE) {Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.} = ! @error = 1 + ObjName($oObj, $OBJ_CLSID) {CLSID of the object's coclass} = ! @error = 1 + ObjName($oObj, $OBJ_IID) {IID of the object's interface} = ! @error = 1 "C:\Example.au3" (17) : ==> The requested action with this object has failed.: $oProforma.Identyfikator $oProforma^ ERROR 51 minutes ago, mLipok said: I was sure that this problem was asked before. So this is all about object which is empty. In this case Com Error Handler will not catch the error. I will just use IsObj() function to catch the error. Thank you Link to comment Share on other sites More sharing options...
mLipok Posted March 1, 2019 Share Posted March 1, 2019 (edited) @maniootek thanks for the HelpFile (CHM file in PM). The problem is how you manage your code here: Local $oProforma = $oSubiekt.Dokumenty.Wczytaj("this string suppose to be valid document number") Spoiler in InsertGT HelpFile: Quote Jeśli dokument nie istnieje w bazie danych, metoda zwraca w VB wartość Nothing (dla innych implementacji obiekt NULL). Celem sprawdzenia, czy dokument istnieje w bazie danych zaleca się użycie metody Istnieje. Quote If the document does not exist in the database, the method returns the Nothing value in VB (for other implementations, the NULL object). In order to check whether a document exists in the database, it is recommended to use the Istnieje method. Public Sub WczytanieIWyswietlenieDokumentu() On Error Resume Next Dim oSgt As InsERT.Subiekt Dim oDok As InsERT.SuDokument Dim CzyIstnieje As Boolean 'Uruchomienie Subiekta GT Set oSgt = UruchomSubiekta() 'Sprawdzenie, czy dokument istnieje w bazie CzyIstnieje = oSgt.Dokumenty.Istnieje("FS 28/MAG/2005") If CzyIstnieje = False Then MsgBox "Dokument nie istnieje w bazie danych" Exit Sub Else 'Wczytuje dokument Set oDok = oSgt.Dokumenty.Wczytaj("FS 28/MAG/2005") End If 'Ukrycie okna Subiekta GT i wyświetlenie okna dokumentu oSgt.Okno.Widoczne = False oDok.Wyswietl End Sub so you should try this: Local $oProforma = Null If $oSubiekt.Dokumenty.Istnieje("this string suppose to be valid document number") then $oProforma = $oSubiekt.Dokumenty.Wczytaj("this string suppose to be valid document number") ......... EndIf Edited March 1, 2019 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted March 1, 2019 Share Posted March 1, 2019 btw. "If the document does not exist in the database, the method returns the Nothing value in VB (for other implementations, the NULL object). " What is "Null Object" ? Is it something other than Null Keyword in AutoIt ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * 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 * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * 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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 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 * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX 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) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 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 *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "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" , 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: 2023-04-24 Link to comment Share on other sites More sharing options...
maniootek Posted March 1, 2019 Author Share Posted March 1, 2019 1 hour ago, mLipok said: so you should try this: This is something similar I already have in my script. This all is about that I just wanted to know why empty object is not catched by com error handler. That's it. If there is no simple answer then I am fine too. 1 hour ago, mLipok said: What is "Null Object" ? I don't know. I never check if object is null. I just check with IsObj() function now Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now