_AutoItErrorTrap (UDF) - Detección de errores en los scripts

y programas personales para otros como tu, puede que te corrijan ;)
Responder
Avatar de Usuario
jscript
Mensajes: 5
Registrado: 12 Oct 2011, 02:29

_AutoItErrorTrap (UDF) - Detección de errores en los scripts

Mensaje por jscript »

Referencia de funciones
__________________________________________________________________________________________________________

_AutoItErrorTrap.au3
UDF para interceptar la ventana de error de AutoIt, que muestra más detalles sobre el error, incluida la capacidad de guardar y enviar por correo electrónico!
( La detección y el tratamiento de los errores en los scripts AutoIt!)

Sintaxis:

Código: Seleccionar todo

; Sumando las directivas abajo, hará que el programa se compila con la indexación de las líneas originales mostrados en SciTE:
#AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in%
#AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in%
;O bien, puede utilizar el programa "ShowOriginalLine.exe" directamente y elegir el script que desea agregar soporte para mostrar las líneas originales!

#include "_AutoItErrorTrap.au3"

; _AutoItErrorTrap ([sTitle [, sText [, fUseCallBack]]])
_AutoItErrorTrap()
Soporta:

Código: Seleccionar todo

;Detección de errores en el script AutoIt y local # Incluye!
, Respecto de la ayuda en AutoIt, la definición de "local Incluye" es:
; ------------------------------------------------- -----------------------------
; Si "..." se utiliza el nombre de archivo se considera en relación con el script actual.
; ------------------------------------------------- -----------------------------
, Lo que significa que para que usted tenga la UDF o el otro módulo externo con soporte para mostrar las líneas originales, se debe utilizar la siguiente manera:
#include "[path] filename", consulte la ayuda en AutoIt para más detalles.
Descargas:

Versión: 0.11
_AutoItErrorTrap.zip

Nota: La detección de errores se realiza en el mismo ejecutable, no requiere la apertura de dos exes para esta acción.! Funciona con CUI demasiado .
Ejemplo de uso está incluido! (Es necesario compilar, pero también trabajamos con guiones no compiladas usando el menú contextual [Run Script ...] )

Muestra:

Imagen

Imagen
Más muestras:
Correcciones:

Código: Seleccionar todo

[list]
0.11.1612.2600[*]16/11/2012 -> [i]Fixes in the codes of the files [b]ShowOriginalLine.au3[/b] and [b]_AutoItErrorTrap.au3[/b][/i]
Was added two parameters in the Directive [i]#ShowOriginalLine_Param:[/i]
This is the list of supported parameters in the Directive: [b]#ShowOriginalLine_Param:[/b]
[code]
/SV or /SkipAllVars ; Skip all Variables to show original line numbers.
/SG or /SkipGlobalVars ; Skip Global Variables to show original line numbers.
/SL or /SkipLocalVars ; Skip Local Variables to show original line numbers.
/OFN or /OnlyFuncNames ; Show original lines only in function names, ignore all other params.
/LPL or /LinePreviewLenght=100 ; Set the lenght of preview line, the value must be > 0 and < 1000 (Default is 50).
0.11.0812.2600
[*]08/11/2012 -> The code was completely rewritten, the code is smaller and more organized, now no longer depends on DialogBoxIndirect, has its own window class name!
The UDF fails in the following in the error "Recursion level has been exceeded...", in this case the only way to intercept the error is using stdout, based on idea by G.Sandler (creator) in OnAutoItErrorRegister ...
- The syntax was changed to the following:

Código: Seleccionar todo

_AutoItErrorTrap ([sTitle [, sText [, fUseCallBack]]])
- The parameter "fUseCallBack" indicates the mode detection of errors:

Código: Seleccionar todo

;True: The error detection is made in the same exe, but will fail on error "Recursion level has been exceeded..."!
;False: Will use "StdOut" to read the error, but will not be compatible with CUI application!
0.10.3012.2600
[*]31/10/2012 -> *The detection of AutoIt statement continuation was improved with the regex posted in the link: http://www.autoitscript.com/forum/topic/145482-question-about-regex/#entry1028087 , made by @Varian. Thank you and all others who contributed...
[*]30/10/2012 -> *Added support for "local #Includes", example:

Código: Seleccionar todo

#include "YourInclude.au3"
And if there are any errors in this include, the error message will look like this:

Código: Seleccionar todo

Line 173 - GUICtrlSetData($iLbl_LineCnv, $asOSLang[50...
Module: Functions.au3
(File "D:DropboxAutoIt v3 - ProjectsCreateFileEmbeddedCreateFilesEmbedded.exe"):

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Environment( AutoIt:3.3.8.1 - Language:0416 - Keyboard:00010416 - OS:WIN_7 / CPU:X64 - OS:X86 )
0.10.2912.2600
[*]30/10/2012 -> *Were added the following directives:

Código: Seleccionar todo

#ShowLine_Off
#ShowLine_On
They form a block that will not be indexed with the original lines, example:
[spoiler]

Código: Seleccionar todo

#ShowLine_Off
$hForm = GUICreate("My GUI menu", 480, 360)

$iFileMenu = GUICtrlCreateMenu("&File")
$iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$iHelpMenu = GUICtrlCreateMenu("?")
GUICtrlCreateMenuItem("Save", $iFileMenu)
GUICtrlSetState(-1, $GUI_DISABLE)
#ShowLine_On
Without them the rows above would be as follows:

Código: Seleccionar todo

$__iLineNumber=1 & " - " & '$hForm = GUICreate("My GUI menu", 480, 360)...'
$hForm = GUICreate("My GUI menu", 480, 360)

$__iLineNumber=3 & " - " & '$iFileMenu = GUICtrlCreateMenu("&File")'
$iFileMenu = GUICtrlCreateMenu("&File")
$__iLineNumber=4 & " - " & '$iFileItem = GUICtrlCreateMenuItem("Ope...'
$iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu)
$__iLineNumber=5 & " - " & 'GUICtrlSetState(-1, $GUI_DEFBUTTON)'
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$__iLineNumber=6 & " - " & '$iHelpMenu = GUICtrlCreateMenu("?")'
$iHelpMenu = GUICtrlCreateMenu("?")
$__iLineNumber=7 & " - " & 'GUICtrlCreateMenuItem("Save", $iFileMenu)'
GUICtrlCreateMenuItem("Save", $iFileMenu)
$__iLineNumber=8 & " - " & 'GUICtrlSetState(-1, $GUI_DISABLE)'
GUICtrlSetState(-1, $GUI_DISABLE)
[/spoiler]
And the directive #ShowOriginalLine_Param with the following options:

Código: Seleccionar todo

/SV or /SkipAllVars ; Skip all Variables to show original line numbers.
/SG or /SkipGlobalVars ; Skip Global Variables to show original line numbers.
/SL or /SkipLocalVars ; Skip Local Variables to show original line numbers.
[*]29/10/2012 -> *Adding the directives below, will cause your program be compiled with the indexing of the original lines shown in SciTE:

Código: Seleccionar todo

#AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in%
#AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in%
*Or you can use the program ShowOriginalLine.exe directly and choose the script you want to add support to show the original lines!
*It was added #region Translations with the variables available for translation!
0.10.2312.2600b
[*]25/10/2012 -> Added support for viewing the last screen before the error! Now the window can expand and retract again...
Change the hook CALLWNDRETPROC to CALLWNDPROC (better...). Added a help button [?] In the main window and minor changes in the code.
0.10.2312.2600b
[*]23/10/2012 -> *Added support to display the original line numbers in the scripts compiled! Thanks to @FireFox for this tip!

Código: Seleccionar todo

$hAET_GETERROR = StringRegExpReplace($hAET_GETERROR, "d+[0-9]", Eval("__iLineNumber") & @CRLF)
*Additional information suggested by @ricky03, thank you!
*Some bugs were fixed and the file ShowOriginalLineNumbers.au3 was added in zip file.
0.10.2112.2600b
[*]21/10/2012 -> Bugs were fixed and a few functions have been rewritten!
0.10.1912.2600b
[*]19/10/2012 -> The UDF was almost completely rewritten, now no longer need to include _AdlibEnhance.au3.
The detection of error is instant and does not consume more CPU. Interface compatibility with Windows XP
0.10.1812.2600b
[*]18/10/2012 -> Improvements such as icons on the buttons and added a button to save the error information!
0.10.1712.2600b
[*]17/10/2012 -> First release![/list]
[/code]
__________________________________________________________________________________________________________

Nota: El tag [spoiler] no existe?

Saludos,

João Carlos.
Avatar de Usuario
Chefito
Profesional del Autoit
Mensajes: 2035
Registrado: 21 Feb 2008, 18:42
Ubicación: Albacete/Cuenca (España)

Re: _AutoItErrorTrap (UDF) - Detección de errores en los scr

Mensaje por Chefito »

Muy interesante la forma de capturar los errores del script. Esto le interesaría a la gente que se los quiere saltar, aunque es código no es acto para novatos :smt001 .

Por cierto, no he podido probar los ejemplos a causa de que mi versión de la udf winapiex.au3 tiene muchas funciones duplicadas con la nueva winapi.au3, y paso de tener que estar borrandolas una a una. Si cuelgas tus udfs funcionales nos harías un favor y podríamos probar tus códigos sin mucho esfuerzo.

Saludos y bienvenido.
Cita vista en algún lugar de la red: En este mundo hay 10 tipos de personas, los que saben binario y los que no ;).
Avatar de Usuario
jscript
Mensajes: 5
Registrado: 12 Oct 2011, 02:29

Re: _AutoItErrorTrap (UDF) - Detección de errores en los scr

Mensaje por jscript »

En ese caso, usted tendrá que actualizar la WinApiEx.au3 UDF...

Esta UDF me ha ayudado mucho con los programas que hago para mis clientes cuando se da un error se hace más fácil de arreglar!

JS
Responder