Jump to content
Sign in to follow this  
PerryRaptor

Send the {Enter} key with ControlCommand()

Recommended Posts

Sometimes I cannot find way way out of a paper bag with a knife in my hand...

I can use ControlCommand() to fill in an EditBox, but I cannot figure out how to send the {Enter} key to the Control ID.

I've tried ControlFocus() and ControlSend() and Send() but nothing works

Share this post


Link to post
Share on other sites

Is there a better way than this...

ControlSetText( "<window title>", "", <control ID>, "put some text in the edit box and send the enter key" & @CRLF)

ControlClick( "<window title>", "", <control ID>)

Edited by PerryRaptor

Share this post


Link to post
Share on other sites

Well there seems to be an issue with reliability...A few times the EditBox is filled with text, but the {Enter} is not happening.

Any ideas to do this in a more relaible way?

Share this post


Link to post
Share on other sites

tried it...doesn't work at all

I wish we had command, option ..."enter", string'... for the ControlCommand() function. For example

ControlCommand("window title", "window text", control ID, "enter", 'string')

Share this post


Link to post
Share on other sites

$hWnd = ControlGetHandle("Untitled - Notepad", "", "Edit1")
$user32 = DllOpen("user32.dll")
$ret = DllCall($user32, "int", "MapVirtualKey", "int", 0x0D, "int", 0)
$lParam = BitOR($ret[0] * 0x10000, BitAND(1, 0xFFFF))
If IsArray($ret) Then
    DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x0D, "long", $lParam)
    Sleep(1)
    DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x0D, "long", BitOR($lParam, 0xC0000000))
EndIf
DllClose($user32)

Is that what you're looking for?

Edited by Outshynd

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...