Sign in to follow this  
Followers 0
failedtocompile

is it possible to capture keys from ControlSend()?

4 posts in this topic

#1 ·  Posted (edited)

Hi Guys,

Just checking if it is possible to capture just the send key part of ControlSend()

I am wanting to output just the keys pressed to a tooltip(), of which i have a collection of about 50 varying keys, so don't want to create a variable for each set of keys in a ControlSend,

and possibly further filter out {ENTER} and {SPACE} using StringRegExp?

My pseudo code

$command = ControlSend("Terminal Window", "", "", "test{SPACE}this{ENTER}")
_IsPressed($command) //check for last keys pressed
  $keyspressed = last keys pressed
tooltip($keyspressed)
clear last keys pressed

$command = ControlSend("Terminal Window", "", "", "testing123{SPACE}this{ENTER}")
check for last keys pressed
  $keyspressed = last keys pressed
tooltip($keyspressed)
Clear last keys pressed

If you could point me in the right direction, that would be great.

Thanks

Edited by failedtocompile

Share this post


Link to post
Share on other sites



Use your imagination.

Example:

Func ControlSendAndToolTipMuahahahahahhaahahahahahahahahahhaha($sText)
    ControlSend("Terminal Window", "", "", $sText)
    tooltip($sText)
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

to get rid of the {ENTER} and {SPACE}:

#include <string.au3>

$originalmessage = "test{SPACE}this{ENTER}"
$newmessage = StringRegExpReplace ($originalmessage, "{SPACE}", "")
$newmessage = StringRegExpReplace ($newmessage, "{ENTER}", "")

MsgBox(0, "", $newmessage)
Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Use your imagination.

Example:

Func ControlSendAndToolTipMuahahahahahhaahahahahahahahahahhaha($sText)
    ControlSend("Terminal Window", "", "", $sText)
    tooltip($sText)
EndFunc

AdmiralAlkex, thanks for your help.

the snippet of code below, is what I came up with and it works really well

While 1
Tooltip($test "Running"',0,0, $counter, 1)
IF NOT WinActive($test,"") THEN
send("{PAUSE}")
ENDIF
$command = testControlSend("test{SPACE}tk101{ENTER}")
sleep($sendDelay)
IF NOT WinActive($test,"") THEN
send("{PAUSE}")
ENDIF
testControlSend("test{SPACE}tk102{ENTER}")
sleep($sendDelay)
IF NOT WinActive($test,"") THEN
send("{PAUSE}")
ENDIF
testControlSend("test{SPACE}tk103{ENTER}")
sleep($sendDelay)
IF NOT WinActive($test,"") THEN
send("{PAUSE}")
ENDIF
Wend

func testControlSend ($sText)
    ControlSend($test, "", "", $sText)

EndFunc

I was trying to avoid the term "k3Y7oo9er" = "key" "log***"

So thanks to you and sleepydvdr for his Regexp example.

have a great weekend.

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