Jump to content

tcpsend of Arrow Keys ?????


Recommended Posts

I just started using AutoIt 5 days ago, so bear with me. I am using telnet to connect to a console device that uses arrow key navigation. In of itself, this was very easy to do using standard telnet.exe and Send("{LEFT}... etc. But I want to read the windows output so in case someone changes the navigation, my script doesn't end up in the wrong menu.

I did some searching and found I can TCPConnect and other commands to TCPRecv (to capture terminal output) and TCPSend (to send terminal input). I already have the program working with the login prompt. But I am not certain of sending the arrow keys for navigation. I did research on available @ characters and it only shows @CR, @LF, @CRLF, and @TAB.

Does anyone know how to pass arrow key presses through TCPSend? Thanks

I should say, automatically send arrow keys. This will be a completely automated script with no user input.

Kevin

Edited by klynch1969
Link to comment
Share on other sites

I'm not very familiar with telnet but I have some hard time to why you need to use the TCP* functions unless you want to re-implement the entire telnet protocol.

And for that matter the arrow keys are nothing that are sent over the to the client. It's client side navigation and can not be remote controlled unless you have some kind key emulate program on the client computer.

I guess StdoutRead is what you are looking for to read the output from a cmd window. There is an example in the helpfile.

Edited by Pain
Link to comment
Share on other sites

My intent is not to re-implement the entire telnet protocol, but to read the output of the telnet window in order to determine the correct number of arrow key presses and in what direction to press an arrow key in order to get to a certain menu item. Currently I know from manually using telnet to connect to a system, that it needs me to press the down arrow key 9 times and then press the right arrow 4 times to get to the menu I am looking for.

The TPCRecv show me all the necessary information, including the horizontal and vertical line positions and all text information. I can parse through this information and determine the correct number of arrow presses to consistently get to the correct menu selection.

What I need is, to know how to TCPSend the movement of the cursor using the arrow keys for navigation. Do I need to code the TCPSend as Chr(##) values? I checked and I don't see arrow keys as valid Chr values.

All the code I am working on is at work, and like a dumb-$ss I forgot to copy it to my flash drive before leaving.

When I am back at work and can test Std functions with my existing code, then I will. But I first wanted to see about TCPSend as an alternative.

So, if anyone knows how to send the arrow keys (similar to Send("{RIGHT #}")), please let me know.

Thanks.

Link to comment
Share on other sites

Also according to http://www.autoitscript.com/forum/index.php?showtopic=20836&st=0&p=614792&hl=telnet%20stdoutread&fromsearch=1&#entry614792 , you can't use StdoutRead with windows telnet (which is what will need to be used unless I use TCPConnect.)

Link to comment
Share on other sites

Have a script on one computer that will receive and send the arrows, then have a script on a different computer sending which arrow it should send.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

You can NOT. At least not in a easy way with a single script.

How you have to do:

Server: (the computer where you send the commands too)

As I told in my previous post the navigation is not implemented in the telnet protocol and can therefore not be remote controlled.

You need some kind of key emulate program (you can make one in Autoit) that listen to commands from the client, when received it executes Send(key).

Client: (the computer that sends the commands)

Here you need a client program connected to the server (also this one can be made in Autoit) that send commands to the server.

Link to comment
Share on other sites

Telnet is nothing more but ascii code sent over TCP stream.

Simply install Wireshark (or some other packet analyzer) and from data part of packet find out what are the ascii codes that are send to server when you are pressing keys in you regular Telnet client. Then you simply have to send same keys by autoit.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...