Jump to content

_AutoItErrorTrap.au3 (UDF) - Error detection in AutoIt scripts!


JScript
 Share

Recommended Posts

No, you just rename like now with debug at the end, and change the name in the include line in the master script!!

It's just en idea...

The very best solution, is the dev integrate this function in the compilation....

Edited by ricky03
Link to comment
Share on other sites

Fixes:


  • 0.10.2512.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.


@ricky03 and @FireFox

Your ideas are valid, but as has been said here that includes must be free of errors!

I still have some ideas including the continuation of the program, I know that many will say it's impossible, but I think it is worth an effort!

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

I still have some ideas including the continuation of the program, I know that many will say it's impossible, but I think it is worth an effort!

Do you really want your program to continue after it's encountered an error that triggers this? Wouldn't that be particularly "dangerous" if your script is dealing with invalid data or a function written wrong?

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 Gude
How 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

With some invalid data not a function written wrong or syntax error! This UDF will not be only to intercept the AutoIt critical errors...

But tell me: Do you like or dislike the program? Give us any thoughts, tips, anything ever help!

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

@JScript

Can you fix the ShowOriginalLineNumbers for this case :

Global $aArray[8][3] = [ _ ;I'm a comment
["D1", "D2", 10], _
...

;after

Global $aArray[8][3] = [ _ ;I'm a comment
$__iLineNumber=10 ;<<THE PROBLEM
["D1", "D2", 10], _
...

Of course I can do it myself, but it's better if you fix it for your next update.

Br, FireFox.

Link to comment
Share on other sites

@FireFox

Skip comment group (#comments-start or #cs) and fix the problem "next line with comment"...

Done! (in next version)

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Fixes:



Edit: Fixed an issue with Select and Switch!

Now the examples have the directives to show the original line when compiled.

The version remains the same.

Regards,

João Carlos.

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Were added the following directives:

#ShowLine_Off

#ShowLine_On

They form a block that will not be indexed with the original lines, example:

#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:
$__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)

And the following directive:

#ShowOriginalLine_Param

With the following options:

  • /SV ; Skip all Variables to show original line numbers;
  • /SG ; Skip Global Variables to show original line numbers;
  • /SL ; Skip Local Variables to show original line numbers.
The version remains the same!

Regards,

João Carlos.

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

New additions:

*Added support for "local #Includes", example:

#include "YourInclude.au3"

And if there are any errors in this include, the error message will look like this:

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 )

Regards,

João Carlos.

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

The detection of AutoIt statement continuation was improved with the regex posted in the link: , made by @Varian.

Thank you and all others who contributed...

The version remains the same!

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • 2 weeks later...

Fixes:


  • 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:

    _AutoItErrorTrap ([Stitle [, sText [, fUseCallBack]]])

    The parameter "fUseCallBack" indicates the mode detection of errors:

    ;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!

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Fixes:


  • 0.11.1612.2600
  • 16/11/2012 -> Fixes in the codes of the files ShowOriginalLine.au3 and _AutoItErrorTrap.au3

    Was added two parameters in the Directive #ShowOriginalLine_Param:

    This is the list of supported parameters in the Directive: #ShowOriginalLine_Param:

    /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).

I hope you enjoy!

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...