failedtocompile Posted May 28, 2011 Share Posted May 28, 2011 (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 May 28, 2011 by failedtocompile Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 28, 2011 Share Posted May 28, 2011 Use your imagination. Example: Func ControlSendAndToolTipMuahahahahahhaahahahahahahahahahhaha($sText) ControlSend("Terminal Window", "", "", $sText) tooltip($sText) EndFunc .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
sleepydvdr Posted May 28, 2011 Share Posted May 28, 2011 (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 May 28, 2011 by sleepydvdr #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
failedtocompile Posted May 29, 2011 Author Share Posted May 29, 2011 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. Link to comment Share on other sites More sharing options...
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