Athos Posted August 6, 2012 Share Posted August 6, 2012 (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 August 6, 2012 by Athos Link to comment Share on other sites More sharing options...
water Posted August 6, 2012 Share Posted August 6, 2012 (edited) First I would put some effort into avoiding the error boxes to pop up. What error message do they display? Edited August 6, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Athos Posted August 6, 2012 Author Share Posted August 6, 2012 (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 August 6, 2012 by Athos Link to comment Share on other sites More sharing options...
water Posted August 6, 2012 Share Posted August 6, 2012 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Athos Posted August 6, 2012 Author Share Posted August 6, 2012 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. Link to comment Share on other sites More sharing options...
AmbiguousJoe Posted August 6, 2012 Share Posted August 6, 2012 (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 August 6, 2012 by AmbiguousJoe Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now