Sign in to follow this  
Followers 0
Athos

Dealing With Error popups

6 posts in this topic

#1 ·  Posted (edited)

Hi Guys, I have a question on how to deal with an error box that I keep getting.

So while my script normally works great, occassionaly, I get an error box (which is tied to a database error).

Keep in mind this is an application error control box and not an Autoit error.

The way a human would deal with this problem would be to click ok at any point that this popup appears. You just keep closing them until you can continue on with the test.

Is there a way to get my script to constantly look for this popup and, if it appears to just click it? (I guess like exception handling)

Edited by Athos

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First I would put some effort into avoiding the error boxes to pop up.

What error message do they display?

Edited by water

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

#3 ·  Posted (edited)

First I would put some effort into avoiding the error boxes to pop up.

What error message do they display?

It's a database error that I have no control over.

Basically It occurs because I'm trying to do something, and the database hasn't finished processing enough stuff for me to do it.

The way I got around this problem before was to simply wait an arbitrary amount of time (like 1 minute) so that the db has enough time to recover. The problem with this, is that the amount of time the database needs to finish processing can vary (sometimes more than a minute).

So instead of just waiting an arbitrary amount of time, I want to able to constantly close these messages until the database has finished it's background processes and I can proceed with the script.

I don't think there is another way to know if the database has finished all its operations otherwise.

Edited by Athos

Share this post


Link to post
Share on other sites

Is this long running process something you started?

How do you access the database?

Which database are we talking about (MS SQL, Oracle ...)?


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

The database runs the background operations of the program I'm automating (think version control but for autocad). I don't think I have any access to this database, so I feel like I have to do it the way I wrote in the OP.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

In order to deal with error message popus in my own script, I first had to find out when they were occuring and the window title of these messages. My script had a navigation function that opened different pages depending on where I told it to go, this was the easiest place for my pop-up checking to be placed, as it was used in nearly every function call. Here's the code I added to deal with a fatal exception window:

If WinExists("P/J Fatal") Then ;If the fatal exception window is open
     WinKill("P/J Fatal") ;Closes the fatal exception window.
     WinWaitClose("P/J Fatal", "", 5) ;waits up to 5 seconds for the window to close.
EndIf

For more specific popups, I put similar code after any action that could result in the popup being opened. In these cases, the popup should appear within a second or two of the action being taken. However, sometimes they wouldn't open, so I needed a way to handle these windows if they opened.

WinWaitActive("Portal/J", "", 3) ;Waits 3 seconds to see if the Portal/J window appears
If WinExists("Portal/J") <> 0 Then ;If the Portal/J window exists
     Send("{ENTER}") ;Sends the Enter key, which will close the menu by selecting the default "Continue" button.
     WinWaitClose("Portal/J", "", 10) ;Waits up to 10 seconds for the window to close.
EndIf

If the window popped up, it would be closed and the script would continue running usually within a second. If the popup didn't appear, no more than 3 seconds would be wasted waiting for a window that may not ever appear. There may be more efficient ways of handling popus, but these methods are the ones that worked for me.

Edited by AmbiguousJoe

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