Jump to content
Sign in to follow this  
anixon

debugging

Recommended Posts

anixon

I have written a program which sequentially calls 100 or so functions. For simplicity and management I have written them as #includes 'individual *.au3' files. When I run the program uncompiled as a script it runs without fault and performs exactly as it has been designed to do. However when it is compiled 'UPX' it occasionally produces an error on 'line -1' which results in the program failing. I have not been able to establish the event that is causing this issue but I have a suspicion that it may be due to some code published elsewhere in this forum that deals with AutoIT and Outlook functionality [send Emails, Reading the Contacts File]. I have been unable to identify the AutoIT event or external influence that is causing the issue. I am relucant to publish due to the length and complexity of the application which would probably impose an unreasonable ask on any contributor therefore for simplicity can someone point me as to how I would universally capture and write the error to a file so that I can establish what code is causing the progam to fail when compiled. This is of course is not an issue when running the code as a script as errors are more readily identifable because of the information written to the console.

Assistance is always appreciated..... Ant..

Share this post


Link to post
Share on other sites
jvanegmond

Capturing the AutoIt error automatically would require encapsulation by another script if you wish, use /ErrorStdOut when running the interpreter and get the error via the standard error stream.

But for these cases, when the option to not compile is not available, I like to use a similar approach to this:

Func _DebugLine($s)
    _Debug($s & @CRLF)
EndFunc

Func _Debug($s)
    ConsoleWrite($s)
    If @Compiled Then
        FileWrite("log.txt", $s)
    EndIf
EndFunc

I am relucant to publish due to the length and complexity of the application which would probably impose an unreasonable ask on any contributor

Fine Sir, you best be trollin'.

Share this post


Link to post
Share on other sites
water

Haven't tried it myself but maybe the "Graphical AutoIt Debugger" could help.

"Debug script in compiled (exe) or script (au3) form."


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×