DavidLago Posted January 15, 2016 Share Posted January 15, 2016 It's easier to see than to explain:1. I IECreate a webpage,$oIE = _IECreate("https://somewebsite.somewhere.net", 1, 1, 0) Local $oImg = _IEImgGetCollection($oIE, 1) If @error Then FileWriteLine(@ScriptDir & "\ObjError.log", "Error ImgCollection - " & @HOUR & ":" & @MIN) Sleep(250) EndIf Sleep(250) Local $sInfo = $oImg.src If @error Then FileWriteLine(@ScriptDir & "\ObjError.log", "Error Img.src - " & @HOUR & ":" & @MIN) Sleep(250) EndIfFirst @error returns something for sure, because its listed in the help file.Second @error, not sure.Is there a way to figure out if setting a variable to a variable.src is causing my script to eventually show this? Link to comment Share on other sites More sharing options...
jguinch Posted January 15, 2016 Share Posted January 15, 2016 If $oImg is not an object, you will have an error with $oImg.src. Add a Else to you first conditionTry this instead :$oIE = _IECreate("https://somewebsite.somewhere.net", 1, 1, 0) Local $oImg = _IEImgGetCollection($oIE, 1) If @error Then FileWriteLine(@ScriptDir & "\ObjError.log", "Error ImgCollection - " & @HOUR & ":" & @MIN) Sleep(250) ; exit the script ? Else Local $sInfo = $oImg.src .... .... .... EndIf Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
AdamUL Posted January 15, 2016 Share Posted January 15, 2016 You can also use IsObj. $oIE = _IECreate("https://somewebsite.somewhere.net", 1, 1, 0) Local $oImg = _IEImgGetCollection($oIE, 1) If @error Then FileWriteLine(@ScriptDir & "\ObjError.log", "Error ImgCollection - " & @HOUR & ":" & @MIN) Sleep(250) EndIf Sleep(250) If IsObj($oImg) Then Local $sInfo = $oImg.src If @error Then FileWriteLine(@ScriptDir & "\ObjError.log", "Error Img.src - " & @HOUR & ":" & @MIN) Sleep(250) EndIf EndIf Adam Link to comment Share on other sites More sharing options...
DavidLago Posted January 15, 2016 Author Share Posted January 15, 2016 jguinch, that way I wouldn't know if there is an issue with $oImg.src or not. I'm thinking there is, because sometimes the page takes a while to load. And since the script measures the time it takes to load, its already inside a loop.Adam, your suggestion might be exactly what I need! Link to comment Share on other sites More sharing options...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 Guys, It seems that the error is happening inside Local $oImg = _IEImgGetCollection($oIE, 1) I'll try to circle around and have an @error looping on it for 30 sec. I'll post it here if it solved the problem. Link to comment Share on other sites More sharing options...
mLipok Posted January 18, 2016 Share Posted January 18, 2016 Which AutoIt version you are using ? 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...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 (edited) @mLipok v3.3.14.2, Windows 7* Edited January 18, 2016 by DavidLago Link to comment Share on other sites More sharing options...
mLipok Posted January 18, 2016 Share Posted January 18, 2016 I think this is a known bug reported on Track. The only thing you can do is wait for the solution to the problem - new beta or release. 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...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 Do you know exactly what is this bug? The description? Is it on collecting the info from the IE? Link to comment Share on other sites More sharing options...
mLipok Posted January 18, 2016 Share Posted January 18, 2016 (edited) https://www.autoitscript.com/trac/autoit/ticket/3167 EDIT: After further reflection, I have to say that this problem is therefore only if you are using the error handler, and yet still have this problem. Edited January 18, 2016 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...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 @mLipok OK, help me understand that: I saw that the bug reported is from a COM error that happens within some versions. But is this related somehow to the collecting of properties from IE with the function I mentioned above? (I'm asking because I really don't know). Maybe the way that _IEImgGetCollection collects the info it needs uses this function with the COM error? Link to comment Share on other sites More sharing options...
mLipok Posted January 18, 2016 Share Posted January 18, 2016 First question is do you use ErrorHandler ? Btw. Yes this this is realted to _IEImgGetCollection ... This UDF should be rewriten ... and is WorkInProgress. 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...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 I do not use the Error Handler. Never used, too. What I'm thinking in order to get around the error problem is something like this: $aWhileT2 = False Local $startLoginTimer = TimerInit() ;Time it While $aWhileT2 = False Local $sInfo = "" Local $oImg = "" Sleep(100) Local $oImg = _IEImgGetCollection($oIE, 1) Sleep(500 ; Give it some time to get the info and sort it in memory If @error Then Sleep(50) ;_ErrorDebug() ; Create a function to write a debug log EndIf Local $sInfo = $oImg.src If $sInfo <> "https://Citrix.somewhere.com/Citrix/Apps/Store/media/DownArrow.png" Then Local $endLoginTimer = TimerDiff($startLoginTimer) $timeLogIn = Round($endLoginTimer / 1000, 1) If $timeLogIn > 30 Then ; Caso exceda 30seg, os usuários podem estar tendo problemas para autenticar. _FileAppendToLine($PathtoLogFile, 1, "resultLogin=failure;" & "statusLogin=Failure: Users might be having problems to authenticate;" & "timeLogIn=Null;") _RenameToFinalLog() _RunDos($KillIECommand) ; KILL IE Exit EndIf Else _FileAppendToLine($PathtoLogFile, 1, "resultLogin=success;" & "statusLogin=Success;" & "timeLogIn=" & $timeLogIn & ";") _RenameToFinalLog() $aWhileT2 = True EndIf WEnd Link to comment Share on other sites More sharing options...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 But now I think I get what that error is... Correct me if I'm wrong: When this error right here happens: Local $oImg = _IEImgGetCollection($oIE, 1) Sleep(500) ; Give it some time to get the info and sort it in memory If @error Then Sleep(50) ;_ErrorDebug() ; Create a function to write a debug log EndIf It crashes, before setting the @error flag to non-zero. amirite? Link to comment Share on other sites More sharing options...
mLipok Posted January 18, 2016 Share Posted January 18, 2016 1 hour ago, DavidLago said: I do not use the Error Handler. Never used, too. So you should start to use it (look in my signature). 1 hour ago, DavidLago said: Local $oImg = _IEImgGetCollection($oIE, 1) Sleep(500) ; Give it some time to get the info and sort it in memory If @error Then Sleep(50) ;_ErrorDebug() ; Create a function to write a debug log EndIf Why you are testing for Error from Sleep() ( this second line reset Error macro ) 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...
jguinch Posted January 18, 2016 Share Posted January 18, 2016 Does the Example 2 in _IEImgGetCollection work for you ? Also, variables should be declaced once, not every time. Can you try with that kind of code ? $aWhileT2 = False Local $startLoginTimer = TimerInit(), $endLoginTimer Local $sInfo, $oImg While $aWhileT2 = False $oImg = _IEImgGetCollection($oIE, 1) If @error Then Sleep(500) Else $sInfo = $oImg.src If $sInfo <> "https://Citrix.somewhere.com/Citrix/Apps/Store/media/DownArrow.png" Then $endLoginTimer = TimerDiff($startLoginTimer) $timeLogIn = Round($endLoginTimer / 1000, 1) If $timeLogIn > 30 Then ; Caso exceda 30seg, os usuários podem estar tendo problemas para autenticar. _FileAppendToLine($PathtoLogFile, 1, "resultLogin=failure;" & "statusLogin=Failure: Users might be having problems to authenticate;" & "timeLogIn=Null;") _RenameToFinalLog() _RunDos($KillIECommand) ; KILL IE _IEQuit() Exit EndIf Else _FileAppendToLine($PathtoLogFile, 1, "resultLogin=success;" & "statusLogin=Success;" & "timeLogIn=" & $timeLogIn & ";") _RenameToFinalLog() $aWhileT2 = True EndIf EndIf WEnd Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
water Posted January 18, 2016 Share Posted January 18, 2016 (edited) With AutoIt 3.3.14.x you need to implement a COM error handler. Else your script will always crash in case of a COM error. The bug in Trak describes a problem when multiple objects/properties are accessed in a single statement. When an error occurres the script crashes even when a COM error handler is defined. Lets assume the following statement: $vResult = $oIE.Collection.Object.Property If Object does not exist then a COM error is raised. But the next processing step is to access Property before the COM error can be returned to the calling script. Only solution at the moment: Split the Statement into pieces and check for errors after each step. Edited January 18, 2016 by water 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...
DavidLago Posted January 18, 2016 Author Share Posted January 18, 2016 1 hour ago, mLipok said: Why you are testing for Error from Sleep() ( this second line reset Error macro ) Right? That was stupid. Haha. I didn't even try (I'm far away from the testing computer now) I'm gonna fix it later. @water Your explanation made it clear to me, thanks a lot for that. @jguinch I'll test that code. It really makes sense to use it like this. If it doesn't work, I'll try to split every property. Link to comment Share on other sites More sharing options...
water Posted January 18, 2016 Share Posted January 18, 2016 Or use Version 3.3.12.0 of AutoIt. Handles COM Errors without the need for a COM error handler and without any bugs 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...
DavidLago Posted January 19, 2016 Author Share Posted January 19, 2016 (edited) @water Something weird happens when I run this version. Let me try to explain: I am in Brazil, and I have a computer in the US running this script, to access a citrix environment and perform a lot of tests, running apps, clocking them, and some more things related to user experience. When I run it from Chile, Colombia and other places nearby, they mostly work. When its far away, such as the US, China, Germany, and a bunch of other countries overseas, eventually the problem happens. After heaps of testing, I figured out that the problem happens here: $oIE = _IECreate("https://citrix.env.net", 1, 1, 0) If @error Then MsgBox(0, "", "error IE CREATE") ; never shows any error EndIf ; If I put a sleep(3000) here, it works most of the plays. If I change to 8000, works everytime. Local $IELoadFlag = False While $IELoadFlag = False $oForms = _IEFormGetCollection($oIE) ; it gets stuck here, it doesn't change the error flag, also never showed the MsgBox If @error Then MsgBox(0, "", "error get collection") Else MsgBox(0, "", "Pass") $IELoadFlag = True EndIf WEnd I put the comments after the lines. It seems that the bug for the COM error still happens here. I think that, when IEFormGetCollection doesn't find an expected object (page not fully loaded), it crashes out, it won't loop, won't even set an @error flag, just out. (OBS: IELoadWait won't work, because the Citrix https blocks it). The behavior looks very much alike the newer versions. Edited January 19, 2016 by DavidLago 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