Sign in to follow this  
Followers 0
deef99

How to kill a Message Box

5 posts in this topic

First... the people in this forum are awesome! I have posted a few questions/problems and received excellent help and ideas! Thanks to all of you!

So I go to post another question here...

I use AutoIT to automate some work for an application, and I have one issue that I just need someone to point me in the right direction to try to resolve.

AutoIT activates an app that processes commands in text files. The operation submits the file to process, but the app may pop a message box [not an AutoIT msgbox] that says "Request Pending until Agent is AUX or AVAIL state" or "Script Completed". Both boxes have an OK button.

During the night, no one is around to click OK. My fear is that these boxes will stack up and possibly stop the operation until they are all clear in the morning when someone comes in and clicks OK on all of them.

How can I:

1. Determine if a box is there

2. Click OK on the box automatically

Hope this question is not stupid.

Thanks in advance!

Dee

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

in normal situations this shud work

$text = 'Request Pending until Agent is AUX or AVAIL state" or "Script Completed"'
If WinExists("",$text) Then
    If Not WinActive("",$text) Then WinActivate("",$text)
    WinWaitActive("",$text)
    Send("{ENTER}");or space or something else controlsend mouseclick controlclick
    WinWaitClose("",$text) ; get the text or wintitle from window with autoit window Tool
EndIf
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Create a watcher script. Use the WinWait feature in a loop, then use controlclick.

Global $s_title_of_popup = "Some Title Here"
Global $s_msgbox_class = "#32770"

While 1
    WinWait("[Title:" & $s_title_of_popup & ";Class:" & $s_msgbox_class & "]")
    ControlClick("[Title:" & $s_title_of_popup & ";Class:" & $s_msgbox_class & "]", "", "Button1")
WEnd
You may need to confirm that "Button1" is the right "ok" button.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Wow! Thank you kindly! Exactly what I needed...you guys are the greatest!!!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Wow! Thank you kindly! Exactly what I needed...you guys are the greatest!!!

It seems that you have your answer/direction - but here is a bit more info in case someone else stumbles across this thread via search:

AdlibEnable ()

Every 250 ms (or time ms) the specified "function" is called--typically to check for unforeseen errors. For example, you could use adlib in a script which causes an error window to pop up unpredictably.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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