Popular Post mLipok Posted September 28, 2018 Popular Post Share Posted September 28, 2018 (edited) Here is my ErrorLog.au3 UDF which I use every day. ErrorLog.au3 UDF is for log program activities and errors, to different output with possibility to switch output function instantly. UDF: expandcollapse popup#include-once #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #Tidy_Parameters=/sort_funcs /reel ; #AutoIt3Wrapper_Run_Debug_Mode=Y Global $__g_bUDF_ERRORLOG_FORCE_DEBUG = False Global $__g_sUDF_ERRORLOG_PREFIX = '--> ' Global $__g_sUDF_ERRORLOG_PREFIX_SUCCESS = '+ ' Global $__g_sUDF_ERRORLOG_PREFIX_EXTENDED = '- ' Global $__g_sUDF_ERRORLOG_PREFIX_ERROR = '! ' #Region ErrorLog.au3 - UDF Header ; #INDEX# ======================================================================================================================= ; Title .........: ErrorLog.au3 UDF - A logging Library ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: ErrorLog.au3 UDF is for log program activities and errors, to different output with possibility to switch output function instantly ; Author(s) .....: mLipok ; Modified ......: ; URL ...........: https://www.autoitscript.com/forum/topic/195882-errorlogau3-a-logging-library/ ; =============================================================================================================================== #cs UDF ChangeLog 2018/10/11 v1.0 * Added: UDF #INDEX# - mLipok * Added: UDF ChangeLog - mLipok * Added: Function: _Log_Errors_Reset() - mLipok * Renamed: Function: _Log_Errors() >> _Log_OnError() - mLipok * Changed: Function: better documentation in function headers - mLipok * Added: ErrorLog__Example.au3 - _Log_Example_1() , _Log_Example_2(), _Log_Example_3() - mLipok 2018/10/12 v1.1 * Added: Function: __Log_Wrapper() - a wrapper which put report to the output function - mLipok * Changed: Function: _Log_SetOutputFunction(Default) - return only function in any other case fires @error - mLipok * Refactored: Function: _Log() - mLipok * Refactored: Function: _Log_OnError() - mLipok * Added: GLOBAL: $__g_bUDF_ERRORLOG_FORCE_DEBUG - mLipok * Added: GLOBAL: $__g_sUDF_ERRORLOG_PREFIX_EXTENDED - mLipok * Added: GLOBAL: $__g_sUDF_ERRORLOG_PREFIX_SUCCESS - mLipok * Changed: GLOBAL: $__g_sUDF_ERRORLOG_ERROR_PREFIX >> $__g_sUDF_ERRORLOG_PREFIX_ERROR - mLipok * Added: Function: _Log_OnSuccess() - Log report to the output function but only if @error was not fired - mLipok * Added: Function: _Log_OnExtended() - Log report to the output function but only if @extended is set and @error was not fired - mLipok * Added: Function: _Log_Debug() - Log report to the output function but only if _Log_SetDebugMode(True) was used - mLipok * Added: Function: _Log_SetDebugMode() - Set the _Log_Debug() ON/OFF - mLipok * Changed: Function: much better documentation in function headers - mLipok * Added: UDF: #Region <> #EndRegion - mLipok * Added: UDF: #Tidy_Parameters=/sort_funcs /reel * Added: ErrorLog__Example.au3 - $__g_bUDF_ERRORLOG_FORCE_DEBUG - _Log_SetDebugMode() - mLipok * Added: ErrorLog__Example.au3 - _Log_Debug() - mLipok @LAST CHANGE LOG #ce UDF ChangeLog #EndRegion ErrorLog.au3 - UDF Header #Region ErrorLog.au3 - Functions ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log ; Description ...: Log report to the output function ; Syntax ........: _Log($sText[, $iError = @error[, $iExtended = @extended]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. Used to store @error ; $iExtended - [optional] an integer value. Default is @extended. Used to store @extended ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if _Log_SetOutputFunction() is not properly set ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log($sText = '', $iError = @error, $iExtended = @extended) __Log_Wrapper( _ (($iError Or $iExtended) ? ($__g_sUDF_ERRORLOG_PREFIX_ERROR & '[ ' & $iError & ' / ' & $iExtended & ' ] : ') : ($__g_sUDF_ERRORLOG_PREFIX)) _ & $sText _ ) Return SetError($iError, $iExtended) EndFunc ;==>_Log ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_Change ; Description ...: Log report to the output function but only if @error or @extended occurs OR if reported data has changed ; Syntax ........: _Log_Change([$sText = ''[, $iError = @error[, $iExtended = @extended]]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. ; $iExtended - [optional] an integer value. Default is @extended. ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if there is no change and no message, or if _Log_SetOutputFunction() is not properly set ; Related .......: _Log ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_Change($sText = '', $iError = @error, $iExtended = @extended) Local Static $sText_static = '' Local Static $iError_static = 0 Local Static $iExtended_static = 0 If $sText <> '' Or $iError Or $iExtended And _ ($sText_static <> $sText Or $iError_static <> $iError Or $iExtended_static <> $iExtended) _ Then _Log($sText, $iError, $iExtended) $sText_static = $sText $iError_static = $iError $iExtended_static = $iExtended EndIf Return SetError($iError, $iExtended) EndFunc ;==>_Log_Change ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_Debug ; Description ...: Log report to the output function but only if _Log_SetDebugMode(True) was used ; Syntax ........: _Log_Debug($sText[, $iError = @error[, $iExtended = @extended]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. Used to store @error ; $iExtended - [optional] an integer value. Default is @extended. Used to store @extended ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if _Log_SetOutputFunction() is not properly set ; Related .......: _Log ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_Debug($sText, $iScriptLineNumber = @ScriptLineNumber, $iError = @error, $iExtended = @extended) If $__g_bUDF_ERRORLOG_FORCE_DEBUG == True Then __Log_Wrapper('@@ Debug(' & $iScriptLineNumber & ') : [ ' & $iError & ' / ' & $iExtended & ' ] : ' & $sText) Return SetError($iError, $iExtended) EndFunc ;==>_Log_Debug ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_Errors_Reset ; Description ...: Resetting @error and @extended to 0 ; Syntax ........: _Log_Errors_Reset() ; Parameters ....: None ; Return values .: None - and set @error and @extended to 0 ; Author ........: mLipok ; Modified ......: ; Remarks .......: this is only wrapper for SetError(0, 0) ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_Errors_Reset() Return SetError(0, 0) EndFunc ;==>_Log_Errors_Reset ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_Errors_ReStore ; Description ...: Restore previously stored @error and @extended ; Syntax ........: _Log_Errors_ReStore() ; Parameters ....: None ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: _Log_Errors_Store ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_Errors_ReStore() _Log_Errors_Store(Default, Default) Return SetError(@error, @extended) EndFunc ;==>_Log_Errors_ReStore ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_Errors_Store ; Description ...: Store @error and @extended ; Syntax ........: _Log_Errors_Store([$iError = @error[, $iExtended = @extended]]) ; Parameters ....: $iError - [optional] an integer value. Default is @error. ; $iExtended - [optional] an integer value. Default is @extended. ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: _Log_Errors_ReStore ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_Errors_Store($iError = @error, $iExtended = @extended) Local Static $iError_static = 0, $iExtended_static = 0 If $iError = Default And $iExtended = Default Then $iError = $iError_static $iExtended = $iExtended_static $iError_static = 0 $iExtended_static = 0 Return SetError($iError, $iExtended) EndIf $iError_static = $iError $iExtended_static = $iExtended Return SetError($iError, $iExtended) EndFunc ;==>_Log_Errors_Store ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_OnError ; Description ...: Log report to the output function but only if @error occurs ; Syntax ........: _Log_OnError($sText[, $iError = @error[, $iExtended = @extended]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. Used to store @error ; $iExtended - [optional] an integer value. Default is @extended. Used to store @extended ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if _Log_SetOutputFunction() is not properly set ; Related .......: _Log ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_OnError($sText, $iError = @error, $iExtended = @extended) If $iError Then __Log_Wrapper($__g_sUDF_ERRORLOG_PREFIX_ERROR & '@error=' & $iError & ' @extended=' & $iExtended & ' :: ' & $sText) Return SetError($iError, $iExtended) EndFunc ;==>_Log_OnError ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_OnExtended ; Description ...: Log report to the output function but only if @extended is set and @error was not fired - mLipok ; Syntax ........: _Log_OnExtended($sText[, $iError = @error[, $iExtended = @extended]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. Used to store @error ; $iExtended - [optional] an integer value. Default is @extended. Used to store @extended ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if _Log_SetOutputFunction() is not properly set ; Related .......: _Log ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_OnExtended($sText, $iError = @error, $iExtended = @extended) If $iExtended And $iError = 0 Then __Log_Wrapper($__g_sUDF_ERRORLOG_PREFIX_EXTENDED & '[ ' & $iError & ' / ' & $iExtended & ' ] : ' & $sText) Return SetError($iError, $iExtended) EndFunc ;==>_Log_OnExtended ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_OnSuccess ; Description ...: Log report to the output function but only if @error was not fired ; Syntax ........: _Log_OnSuccess($sText[, $iError = @error[, $iExtended = @extended]]) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; $iError - [optional] an integer value. Default is @error. Used to store @error ; $iExtended - [optional] an integer value. Default is @extended. Used to store @extended ; Return values .: None - and set @error and @extended to stored values ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function will not send log reports to output if _Log_SetOutputFunction() is not properly set ; Related .......: _Log ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_OnSuccess($sText, $iError = @error, $iExtended = @extended) If $iError = 0 Then __Log_Wrapper($__g_sUDF_ERRORLOG_PREFIX_SUCCESS & '[ ' & $iError & ' / ' & $iExtended & ' ] : ' & $sText) Return SetError($iError, $iExtended) EndFunc ;==>_Log_OnSuccess ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_SetDebugMode ; Description ...: Set the _Log_Debug() ON/OFF ; Syntax ........: _Log_SetOutputFunction($bForceDebug) ; Parameters ....: $bForceDebug - a boolean value. True=ON, False=OFF for _Log_Debug() ; Return values .: none or set @error to 1 ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: _Log_Debug ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_SetDebugMode($bForceDebug) If Not IsBool($bForceDebug) Then Return SetError(1) $__g_bUDF_ERRORLOG_FORCE_DEBUG = $bForceDebug EndFunc ;==>_Log_SetDebugMode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Log_SetOutputFunction ; Description ...: Set the function to which Log reports should be passed ; Syntax ........: _Log_SetOutputFunction([$fnFunction = Default]) ; Parameters ....: $fnFunction - [optional] a floating point value. Default is Default. ; Return values .: $fnFunction_static - saved output function, in any other case fires @error ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Log_SetOutputFunction($fnFunction = Default) Local Static $fnFunction_static = Null If $fnFunction = Default And IsFunc($fnFunction_static) Then Return $fnFunction_static If Not IsFunc($fnFunction) Then Return SetError(1) $fnFunction_static = $fnFunction Return $fnFunction_static EndFunc ;==>_Log_SetOutputFunction #EndRegion ErrorLog.au3 - Functions #Region ErrorLog.au3 - Internal Functions ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __Log_Wrapper ; Description ...: a wrapper which put report to the output function ; Syntax ........: __Log_Wrapper($sText) ; Parameters ....: $sText - a string value. Textual data which should be reported to the output function ; Return values .: None or set @error = 1 in case _Log_SetOutputFunction() was not used or used not properly ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: _Log, _Log_OnError, _Log_OnExtended, _Log_OnSuccess, _Log_Change ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __Log_Wrapper($sText) Local $fnFunction = _Log_SetOutputFunction() If @error Then Return SetError(1) $fnFunction($sText) EndFunc ;==>__Log_Wrapper #EndRegion ErrorLog.au3 - Internal Functions EXAMPLE: expandcollapse popup#include <WinAPIProc.au3> #include-once #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #AutoIt3Wrapper_Run_Debug_Mode=Y ; #Tidy_Parameters=/sort_funcs /reel #include <Debug.au3> #include "ErrorLog.au3" If Not @Compiled Then $__g_bUDF_ERRORLOG_FORCE_DEBUG = True ; Pre set function to where log report is passed _Log_SetOutputFunction(ConsoleWrite) _Log_Debug("EXAMPLE 1: START" & @CRLF, @ScriptLineNumber) _Log_Example_1() ; check again for @error If @error Then MsgBox($MB_ICONERROR, 'Example 1: Error Occured', _ 'File Reading Problem.' & @CRLF & _ '@error = ' & @error & @CRLF & _ '@extended = ' & @extended _ ) _Log_Debug("EXAMPLE 2: START" & @CRLF, @ScriptLineNumber) _Log_Example_2() _Log_Debug("EXAMPLE 3: START", @ScriptLineNumber) _Log_Example_3() _Log_SetOutputFunction(_ConsoleWrite_Wrapper) _Log_Debug("EXAMPLES: END", @ScriptLineNumber) Func _Log_Example_1() ; sending description to log output _Log('Example 1: We are trying to read file.' & @CR) ; fire @error FileRead('FILE PATH WHICH NOT EXIST') ; report @error but do not change it - store it and back it again _Log_OnError('Example 1: File Reading Problem.' & @CR) Return SetError(@error, @extended) EndFunc ;==>_Log_Example_1 Func _Log_Example_2() ; set function to where log reports will be passed _Log_SetOutputFunction(_ConsoleWrite_Wrapper) ; sending description to log output _Log('Example 2: We are trying to read file.') For $iAttempt_idx = 1 To 15 _log('Example 2: $iAttempt_idx = ' & $iAttempt_idx) ; fire @error If $iAttempt_idx < 14 Then FileRead('FILE PATH WHICH NOT EXIST') ; next line will log only in step #12 and #13 - as only to step #13 , errors ocurrs If $iAttempt_idx > 11 Then _Log_OnError('Example 2: File Reading error' & @CR) ; fake @error to show what _Log_Change() will do when @error is changing If $iAttempt_idx = 5 Then SetError(2) ; fake @exteneded to show what _Log_Change() will do when @exteneded is changing If $iAttempt_idx = 10 Then SetError(@error, 2) ; string change If $iAttempt_idx > 13 Then _Log_Change('Some other log data') ; report to log output but only first unique occurance _Log_Change('Example 2: File Reading Problem.' & @CR) _Log_Errors_Reset() ; if you do not reset then @error and @extended could be followed to next loop. Next EndFunc ;==>_Log_Example_2 Func _Log_Example_3() ; set function to where log reports will be passed _Log_SetOutputFunction(_ConsoleWrite_Wrapper) ; sending description to log output _Log('Example 3: We are trying to read file.') For $iAttempt_idx = 1 To 15 ; If $iAttempt_idx = 9 change output function - from this moment log reports will be passed to _DebugOut() instead _ConsoleWrite_Wrapper() If $iAttempt_idx = 9 Then _DebugSetup("Example 3: ErrorLog.au3 - output") _Log_SetOutputFunction(_DebugOut) EndIf _log('Example 3: $iAttempt_idx = ' & $iAttempt_idx) ; fire @error If $iAttempt_idx < 14 Then FileRead('FILE PATH WHICH NOT EXIST') ; next line will log only in step #12 and #13 - as only to step #13 , errors ocurrs If $iAttempt_idx > 11 Then _Log_OnError('Example 3: File Reading error') ; fake @error to show what _Log_Change() will do when @error is changing If $iAttempt_idx = 5 Then SetError(2) ; fake @exteneded to show what _Log_Change() will do when @exteneded is changing If $iAttempt_idx = 10 Then SetError(@error, 2) ; string change If $iAttempt_idx > 13 Then _Log_Change('Example 3: Some other log data') ; report to log output but only first unique occurance _Log_Change('Example 3: File Reading Problem.' & @CR) _Log_Errors_Reset() ; if you do not reset then @error and @extended could be followed to next loop. Next EndFunc ;==>_Log_Example_3 Func _ConsoleWrite_Wrapper($sData) ConsoleWrite($sData & @CRLF) EndFunc ;==>_ConsoleWrite_Wrapper REMARKS: Documentation in function headers is currently complete Edited October 12, 2018 by mLipok MarkIT, argumentum, user4157124 and 3 others 4 2 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...
Danyfirex Posted September 28, 2018 Share Posted September 28, 2018 I really like it's very short. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
mLipok Posted October 11, 2018 Author Share Posted October 11, 2018 New version in first post: Quote #cs 2018/10/11 v1.0 * Added: UDF #INDEX# * Added: UDF ChangeLog * Added: Function: _Log_Errors_Reset() * Renamed: Function: _Log_Errors() >> _Log_OnError() * Changed: Function: better documentation in header #ce Danyfirex 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...
mLipok Posted October 12, 2018 Author Share Posted October 12, 2018 (edited) New version inf first post: Quote 2018/10/12 v1.1 * Added: Function: __Log_Wrapper() - a wrapper which put report to the output function - mLipok * Changed: Function: _Log_SetOutputFunction(Default) - return only function in any other case fires @error - mLipok * Refactored: Function: _Log() - mLipok * Refactored: Function: _Log_OnError() - mLipok * Added: GLOBAL: $__g_bUDF_ERRORLOG_FORCE_DEBUG - mLipok * Added: GLOBAL: $__g_sUDF_ERRORLOG_PREFIX_EXTENDED - mLipok * Added: GLOBAL: $__g_sUDF_ERRORLOG_PREFIX_SUCCESS - mLipok * Changed: GLOBAL: $__g_sUDF_ERRORLOG_ERROR_PREFIX >> $__g_sUDF_ERRORLOG_PREFIX_ERROR - mLipok * Added: Function: _Log_OnSuccess() - Log report to the output function but only if @error was not fired - mLipok * Added: Function: _Log_OnExtended() - Log report to the output function but only if @extended is set and @error was not fired - mLipok * Added: Function: _Log_Debug() - Log report to the output function but only if _Log_SetDebugMode(True) was used - mLipok * Added: Function: _Log_SetDebugMode() - Set the _Log_Debug() ON/OFF - mLipok * Changed: Function: much better documentation in function headers - mLipok * Added: UDF: #Region <> #EndRegion - mLipok * Added: UDF: #Tidy_Parameters=/sort_funcs /reel * Added: ErrorLog__Example.au3 - $__g_bUDF_ERRORLOG_FORCE_DEBUG - _Log_SetDebugMode() - mLipok * Added: ErrorLog__Example.au3 - _Log_Debug() - mLipok EDIT: quick fix Edited October 12, 2018 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 October 12, 2018 Author Share Posted October 12, 2018 On 28.09.2018 at 1:19 PM, Danyfirex said: I really like it's very short. Unfortunately, it's getting longer 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...
Danyfirex Posted October 13, 2018 Share Posted October 13, 2018 it's still relatively short. About 100 lines without functions header. long does not steal elegance. Saludos argumentum 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
mLipok Posted October 14, 2018 Author Share Posted October 14, 2018 added by to Wiki:https://www.autoitscript.com/wiki/User_Defined_Functions#Script_Coding.2FAnalyzing.2FDebugging 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...
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