sud Posted February 18, 2016 Posted February 18, 2016 I have written following code in which I want to send "Enter" to a message but not working. tried lots of thing but no success. following is the code. send function in bold is not working... Please help. Thanks in advance. #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> Run("notepad.exe") WinWaitActive("Untitled - Notepad") Sleep(1000) send("This is for test only!!") Sleep(1000) If WinActive("[CLASS:Notepad]") Then ; Check if Notepad is currently active. MsgBox($MB_SYSTEMMODAL, "Message", "WinActive" & @CRLF & "Notepad is active.") Else MsgBox($MB_SYSTEMMODAL, "Message", "WinActive" & @CRLF & "Notepad is not active.") EndIf Sleep(1000) Send("{ENTER}") ;ControlClick("", "", 79, 18) ;MouseClick("", 698, 574) WinClose("Untitled - Notepad") WinWaitActive("Notepad", "Save") Sleep(1000) Send("!n")
JohnOne Posted February 18, 2016 Posted February 18, 2016 (edited) First, what does "send "Enter" to a message" mean? Second, what is it, you expect to happen? Be precise, and thorough. Edited February 18, 2016 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
sud Posted February 18, 2016 Author Posted February 18, 2016 Hi, Thanks reply.... First what does "send "Enter" to a message" mean? : It means pressing enter key of keyboard after the popup message came from if/else conditions. Second what is it, you expect to happen? : The same is expected..It should hit Enter after the popup message. As result of If/else conditions, below message will popup on screen and what I was trying to do is to hit enter after this and close this popup.
ViciousXUSMC Posted February 18, 2016 Posted February 18, 2016 (edited) MsgBox is a Blocking Function. While active the entire script is on hold. It will not proceed to send enter until you click "OK" to resume the script. You may just want to put a timeout value on your MsgBox if you intend for it to go away on it's own without user interaction. Edited February 18, 2016 by ViciousXUSMC sud 1
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