Solved

automatically click OK to close a dialog box

Posted on 2009-07-02
4
1,439 Views
Last Modified: 2013-11-10
Hi
I've got a program, which show me dialog box with a message and OK button to close it. I have to click on it nearly thousand times, which is impossible. Unfortunately this is very specific program, it's in beta now, but I have to use it. Developers were notified, but it may take a lot of time till I get a new version.
So as a temporary workaround may be I can find a small (better free) utility to automatically click OK and close this dialog once it appears. It should not affect my other work on the computer. Can anybody help?
I'm working under Windows XP Pro SP2.
Thanks
0
Comment
Question by:yuk99
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:iUsername
ID: 24765576
use FindWindow() function to find the window, and than send the message WM_CLOSE to the window.

If you MUST click on the OK button, you can use GetWindow() to get to the next child window (probably the button OK, or keep on going until you find that button, and send to it WM_CLICK.

You can use AutoIt 3 to write such a script real fast and easy.
0
 
LVL 15

Author Comment

by:yuk99
ID: 24765734
I'm not going to develop this program myself. AutoIt3 may be a good solution. Will study. Can you help me with a script? To wait for a window with exact title and click OK.
0
 
LVL 5

Accepted Solution

by:
iUsername earned 500 total points
ID: 24766315
Try the following autoit code.
you need to enter the dialog box title, and you can enter another parameters to WinWaitActive() that contains the text in the dialog box.

While True
	
	; wait for the dialog box window
	WinWaitActive("dialog box title here")
	Send("{ENTER}")
	
WEnd

Open in new window

0
 
LVL 15

Author Closing Comment

by:yuk99
ID: 31599330
Thanks!
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question