Jump to content

debugging


anixon
 Share

Recommended Posts

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

Link to comment
Share on other sites

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'.
Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...