iloveauto Posted December 30, 2005 Posted December 30, 2005 1)How to use AutoIt3 to send a signal to Message Box? Currently, I have one executable program that always shows up a message box with "OK"&"Cancel" button, I do not want to click the button every time and try to use AutoIt to send "OK" to it automatically. However, the send() only is useful to Window, not to message box, what should i do now? 2)is this possible to get the handle of message box in a running program? thank you.
BigDod Posted December 30, 2005 Posted December 30, 2005 1)How to use AutoIt3 to send a signal to Message Box? Currently, I have one executable program that always shows up a message box with "OK"&"Cancel" button, I do not want to click the button every time and try to use AutoIt to send "OK" to it automatically. However, the send() only is useful to Window, not to message box, what should i do now? 2)is this possible to get the handle of message box in a running program? thank you.If it is an AutoIt messagebox it can be setup with a timeout. MsgBox(4096, "Test", "This box will time out in 10 seconds", 10) If not you will have to show us some of your script so that we can see what you have tried. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
iloveauto Posted December 30, 2005 Author Posted December 30, 2005 ; 1 code:This is one program to show a message box. ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) $answer = MsgBox(4,"Message Box", "This script will active a message box with Yes/No?") Exit ----------------------------------------------------------------- ;This is the program that sends a "Yes" to above message box #include <GUIConstants.au3> opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced $handle = WinGetHandle("Message Box", "Yes") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else ; Send "Yes" to the message box to close it ControlSend("Message Box","Yes",$handle, "y") ;Send("y") MsgBox(0,"Succ","good") EndIf Exit ---------------------------------------------------------- Thank you
BigDod Posted December 30, 2005 Posted December 30, 2005 ChangeControlSend("Message Box","Yes",$handle, "y")toControlSend($handle,"",6, "{ENTER}") Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Moderators SmOke_N Posted December 30, 2005 Moderators Posted December 30, 2005 If you know the title of the MsgBox(), you don't need the handle: As long as these are 2 different scripts then you could do this. If WinExists("Message Box") Then ControlClick("Message Box", "&Yes", "Button1") Else WinWait("Message Box") ControlClick("Message Box", "&Yes", "Button1") EndIf 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.
iloveauto Posted December 30, 2005 Author Posted December 30, 2005 Thank you, guys. you are so helpful. it works
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now