Sign in to follow this  
Followers 0
bmccollum

How to Handle Unforeseen Errors When Controlling an Application's GUI via AutoIT?

7 posts in this topic

#1 ·  Posted (edited)

I'm working on some coding to take control of a proprietary Windows-based pension planning software application for a client.

I'm understanding little by little how to code in AutoIT to open the software, select menu items to go to various screens, place checkmarks in various checkbox fields, fill-in text box fields with specific text, automatically click buttons, etc.

What I'm having trouble getting my mind around is how to code to efficiently handle errors if, let's say, something doesn't go correctly with the automation control attempts and the pension planning software's interface doesn't continue moving through the flow of steps expected & gives me an error msg.  At that point, if the AutoIT steps continue moving forward, the process of course isn't going to work.

What I'm thinking of as a better example is let's say AutoIT gets to a point in the control of the pension planning software's user interface where it pastes in a path to a particular file that's expected to be there (ex:  "c:tempSomeFile.txt") that the software needs to process.  Let's suppose the AutoIT code pastes-in the path of "c:tempSomeFile.txt" and a "Process" button click is communicated from the AutoIT code and it turns out that the "c:tempSomeFile.txt" file isn't present for some reason.  At this point, how do I code things in AutoIT to handle a situation like that where the remaining 10 steps aren't going to be able to be controlled/completed by AutoIT since we're dead in the water due to the expected "c:tempSomeFile.txt" file not being present?

Many thanks for any recommendations or short code snippets/examples you may currently utilize in efficiently recognizing and handling errors such as this as to know that you've reached a step in the expected flow of GUI control to where you have to gracefully exit.

Thanks!

Edited by bmccollum

Share this post


Link to post
Share on other sites



Let's suppose the AutoIT code pastes-in the path of "c:tempSomeFile.txt" and a "Process" button click is communicated from the AutoIT code and it turns out that the "c:tempSomeFile.txt" file isn't present for some reason. 

 

For a start, you would check the file exists before pasting it, you would also check for the error msg and deal with it the same way you would manually.

Before we start going around in circles with me asking you to post code and then you telling me there's some sort of proprietary reason why you can't and then me asking to code some example in some other software... please jump straight to the last step.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

You know, that off-the-cuff example I gave of the program erroring-out due to not finding a specific file was a bad one.  As you said, I'd logically write some code to check to see if the file exists before pushing forward with having AutoIT place the filename in the textbox / etc.  Poor example on my part.  My bad there.

So it sounds like what I need to do is to just find the potential failure points throughout the automated control of the software's GUI via AutoIT and code to recognize that (for example) a window titled "Error Occurred with Process XYZ" has displayed, have the AutoIT code click the OK button, and then cease running any of the remaining AutoIT code.

Thanks again.  Very new to AutoIT and slowly working my way through how to accomplish the desired tasks.

Share this post


Link to post
Share on other sites

Thanks for the suggestion.  Have made a note of that and will research this weekend.  Have a great weekend!

Share this post


Link to post
Share on other sites

on mine application I had to move the mouse to a certain location and copy a section of text.  If the resulting text was not the desired result I close the window and start over

Share this post


Link to post
Share on other sites

As J1 stated above, you should avoid the instability created with things such as MouseMove, MouseClick, Send, PixelSearch, etc. unless absolutely necessary.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

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