Jump to content

Is it possible for Autoit to log errors to text file?


Recommended Posts

ie, everytime my script encounters an error, instead of popping an error message then croaking, it instead either writes the error into a text file (line # or whatever), or execute an external app.

PS.. I am not referring to handling "@error" codes.
 

Is it possible?

thanks!

Dan

 

Edited by Burgaud
Link to comment
Share on other sites

  • Moderators

You say "not handling @error codes", but you need to handle the errors (whether that is a pop up or writing to a log file or the event viewer) in order to do something with them; it isn't an automatic thing. How about an example of an error you're meaning to catch, so we can offer suggestions?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

i dont need/want to handle the errors.

I want autoit instead of croaking and popping the error window, it would print it to file so I can review it.

By "it" I am not referring to my script, but the autoit engine itself.

Example of error? If I know where the error I wont be asking... whenever the error occurs, the users would click click and no more evidence of error...

Edited by Burgaud
Link to comment
Share on other sites

  • Moderators

If autoit.exe "croaks and pops an error window" it is because of something in your code, so yes you as the one writing the code have to handle it. What other language do you know that automatically handles every possible error? AutoIt doesn't just randomly crash; if you cannot come up with an example in which this "croaking" occurs, how can you expect anyone to assist?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

You mean something like this?

1628661076_AutoItError.png.179f501438d6e449e527548c35042f9c.png

If yes, then there is a way to write this to a file for debugging.

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

  • Moderators

@water you are correct, but I would not call that "the AutoIt Engine croaking" personally; it would still be something that should be accounted for in the code.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Correct :)
I once had the need to write such messages to a file because my script (which was far from being perfect) was run on a server. When the message popped up the script simply hung
and I had no idea what caused the problem.
So writing the error message to a file greatly helped to pin down the cause. I then changed the code to handle the problem for the future.

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

trancexx helped me to solve this problem:

 

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