Jump to content

Need Help... Send("{ENTER}") is not working


sud
 Share

Recommended Posts

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")

 

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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 by ViciousXUSMC
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...