Sign in to follow this  
Followers 0
Munro

Close a windows message box

3 posts in this topic

Hi guys, first time posting here.

I'm currently running into a problem with a windows application. The application is running in the background (it's opened in the windows taskbar). Sometimes, it encounter an error, and a message box is shown. We have to click ok on the message box and the application keeps running afterward.

The problem I have is that the title of the message box is the same as the application itself, so if I use if(WinExists ... then WinClose, it close the application completly. I thought about sending the enter key, but since WinExists always find something, the script will send enter keys when I'm working.. which is not what I want.

I thought about using WinGetPos, so if the windows is actually opened, it could close it. I couldn't find any info about it though.

I normally wouldn't use a script for this, since clicking ok on a window is not hard (it only errors about once per day). However, I'm not always on the computer and the application has to run fulltime. If there is a way to know that the message box appeared, i'll just start the script once I'm not on the computer.

Thanks to anyone helping,

Munro

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the program is in the background and you're not actively using it you can try using WinWaitActive so when the message box is active you can choose out of a few methods to close it, send enter, send O (from Ok, usually works), control click, mouse click and others....If that doesn't help let me know.

Also keep in mind that you can use a hot key, so the program starts waiting for the window when you press F5 (for example) and you stop it when you return with F6

Edited by AoRaToS

s!mpL3 LAN Messenger

Current version 2.9.8.8 [30/09/2015]

Download Here

s!mpL3

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The problem I have is that the title of the message box is the same as the application itself, so if I use if(WinExists ... then WinClose, it close the application completly.

Check out the error dialog with the Window info tool (AU3Info.exe) and see if there is any visible text, like "An error occurred". Then you can add the text parameter to your WinExists() and only match the error.

You could also turn on advanced match mode and use class, since the error dialog window is likely a different class from the main app.

:mellow:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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