Solved

automatically click OK to close a dialog box

Posted on 2009-07-02
4
1,424 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now