Sign in to follow this  
Followers 0
PerryRaptor

Send the {Enter} key with ControlCommand()

9 posts in this topic

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



#2 ·  Posted (edited)

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

@PerryRaptor,

Are you feelin' alright? You seem to be talking to yourself in this thread :-)

How about a ControlClick to replace the ENTER?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

ControlSend?

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

#7 ·  Posted (edited)

$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

Yeah, but I discovered ..."EditPaste", 'string'... works

...Like I said, holding a knife doesn'r mean I can get out of a paper bag

Share this post


Link to post
Share on other sites

..."EditPaste", 'string'...

I've not had a opportunity to use that one yet. Glad you got it working.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  
Followers 0