NATO Posted February 15, 2008 Share Posted February 15, 2008 Hi there, I'm scripting an automated telnet session using TCPSend/TCPRecv. It's working beautifully enough for me to step through screens in the session, verify I'm at the screen I want to be at, etc. However, I'm running into a wall when I try to send an F key via TCPSend. I tried using the hex code (77) generated by this script, which will output the hex code for any key pressed to the SciTE console: #include <Misc.au3> While 1 Sleep(50) For $i = 1 To 255 If _IsPressed(Hex($i, 2)) Then ConsoleWrite(Hex($i,2) & @LF) Next WEnd But no luck. The F8 key never gets pressed. Here's an excerpt of the script I'm working on, including my attempt at using the hex code from above-- ...lots of other code... ;trying to send the 'F8' key here-- TCPSend($MainSocket, "0x77") sleep(500) $Data = TCPRecv($MainSocket, $MaxLength) If $Data = "" Then MsgBox(0, "Error", $Data) EndIf While 1 If StringInStr($Data,"success in pressing F8") Then ExitLoop $Data = TCPRecv($MainSocket, $MaxLength) WEnd ...lots more code... Any help will be greatly appreciated! Thanks in advance. Link to comment Share on other sites More sharing options...
NATO Posted February 18, 2008 Author Share Posted February 18, 2008 No thoughts, guys?? These F-keys are killing me! Link to comment Share on other sites More sharing options...
NATO Posted February 19, 2008 Author Share Posted February 19, 2008 Well, still no luck. I guess the TCPSend command just can't send non-printable keys. I guess I'll just look into scripting my project using PuTTY or something instead. Link to comment Share on other sites More sharing options...
erezlevi Posted February 20, 2008 Share Posted February 20, 2008 Well, still no luck. I guess the TCPSend command just can't send non-printable keys. I guess I'll just look into scripting my project using PuTTY or something instead. hi, try: TCPSend ($connectedsocket,Binary (0x1b4f50)); send F1 TCPSend ($connectedsocket,Binary (0x1b4f51)); send F2 TCPSend ($connectedsocket,Binary (0x1b4f52)); send F3 TCPSend ($connectedsocket,Binary (0x1b4f53)); send F4 Link to comment Share on other sites More sharing options...
NATO Posted February 20, 2008 Author Share Posted February 20, 2008 hi, try: TCPSend ($connectedsocket,Binary (0x1b4f50)); send F1 TCPSend ($connectedsocket,Binary (0x1b4f51)); send F2 TCPSend ($connectedsocket,Binary (0x1b4f52)); send F3 TCPSend ($connectedsocket,Binary (0x1b4f53)); send F4 Unfortunately, it didn't work. Growl! Thanks for the suggestion, though! Link to comment Share on other sites More sharing options...
NATO Posted February 21, 2008 Author Share Posted February 21, 2008 hi, try: TCPSend ($connectedsocket,Binary (0x1b4f50)); send F1 TCPSend ($connectedsocket,Binary (0x1b4f51)); send F2 TCPSend ($connectedsocket,Binary (0x1b4f52)); send F3 TCPSend ($connectedsocket,Binary (0x1b4f53)); send F4 Ha! Got it! You were very close, but it turns out that I needed to use this: TCPSend ($connectedsocket,Binary("0x154f51")) Just needed to add some quotes around my expression. Thanks, guys! 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