Sign in to follow this  
Followers 0
ZiggyStardust

Recovery from "AutoIt has encountered and error and needs to close"

14 posts in this topic

I have a script that will (by way of user interaction) generate the Windows standard "autoit has encountered a error and needs to close... send, don't send" and the program terminates.

Is there any way around this (other then shooting the user)? Utlimately what I would like to do is re-run the program if it crashes or better still keep this from happening.

Thanks!

Share this post


Link to post
Share on other sites



without seeing the script, there's no way to answer this.


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

Share this post


Link to post
Share on other sites

I can tell you what triggers it. I do I/O to a virtual COMPort (USB). If I pull the USB cable out of the computer while the script is running it generates the Windows crash.

"autoit.exe has encountered a problem and needs to close. We are sorry about the inconvenience". Since this is a Windows Error is there any way I can control it?

Share this post


Link to post
Share on other sites

What BrewManNH meant is: We need some AutoIt code to see how you do it and if there is anything we can do about the problem.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

ZiggyStardust,

You are already have a thread open on this subject - why have you started another? :huh:

And you know what the end result will be if you keep on doing this. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Here is the lowest level I/O I do:

Func CommSend($SendStr)

$Received = ""

_CommSendString($SendStr & @CR, 0)

If @error <> 0 Then

$CommError = True

WriteLog("Error sending " & $Sendstr)

Return

EndIf

$Received = _CommGetLine(">", 100, 2000); Should get back speed

If @error <> 0 Then

$CommError = True

WriteLog("Error receiving " & $Received)

Return

EndIf

$Received = StringStripWS($Received, 8) ; Strip Carriage Returns

EndFunc

Share this post


Link to post
Share on other sites

I presume the errors are documented in the UDF. Try and catch them and see if you can throw an exception just before it crashes.

Share this post


Link to post
Share on other sites

Do you compile the script for 32 bit? The UDF states that "the dll is 32 bit so it will not work with a 64 bit app"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Just thinking out loud. Since this exception can't be handled would anyone see a problem with running yet a second script which would do nothing more than make sure the first script was running. If the second script crashed with the exception the first script would simply re-run the second script.

I know from experience that, as a rule, when you get one of these exception errors you might as well reboot because nothing is going to work right. Any other input on how I can handle this?

Share this post


Link to post
Share on other sites

Which version of AutoIt do you use? The latest beta has a changed way of handling COM errors - a crash should never again occur caused by a COM error if you handle @error properly.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

3.3.8.1? How do you tell for sure? I am a little fuzzy about what is classified as a "COM" error. I tried putting in a COM Error Handler yesterday and unplugging the USB cable. It blew right past the COM Error Handler and crashed. You really think the beta would catch this unhandled exception error and let me recover from it?

Google has failed me! What is the definition of a "COM Error". I am especially curious as to what the COM stands for. All I can find is that it is a generic term for a Windows crash.....

Edited by ZiggyStardust

Share this post


Link to post
Share on other sites

If the COM error handler doesn't catch the error situation then I'm out of ideas <_<


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks Water. Per your suggestion I installed Beta 3.9.4.0 and there was even a COM Error Handler test. The test ran and caught the COM Error. I put the Error Handler in my script and it blew right past it and crashed.

I am out of things to try. I left a post on the CommMG UDF thread. Maybe a suggestion will turn up. Your suggestions and input were greatly appreciated!

Share this post


Link to post
Share on other sites

When the script crashes even when using a COM error handler and the latest beta then COM isn't used by the UDF or is used in a way so that AutoIt can't handle the error (I'm no specialist in this area - that's how I understand it).

I hope you get some answer on the CommMg thread.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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  
Followers 0