Representing arrow keys in a string

A

Arindam Goswami

I am using Ruby's Telnet class to establish a session with a remote
Linux machine to automate some remote administrative tasks.

The problem I am facing is this- At one point I come across a menu,
where the arrow keys have to be used to select certain options.

Is there any way to represent the arrow keys in the string that I am
sending to the remote machine?

Do let me know if you have any other ideas/suggestions?
 
M

Michael Linfield

Arindam said:
I am using Ruby's Telnet class to establish a session with a remote
Linux machine to automate some remote administrative tasks.

The problem I am facing is this- At one point I come across a menu,
where the arrow keys have to be used to select certain options.

Is there any way to represent the arrow keys in the string that I am
sending to the remote machine?

Do let me know if you have any other ideas/suggestions?

instead of trying to make ruby know uve pushed an arrow key, think of
what command pressing a certain key does, then try to execute that
command in ruby code :)
 
A

Arindam Goswami

Michael said:
instead of trying to make ruby know uve pushed an arrow key, think of
what command pressing a certain key does, then try to execute that
command in ruby code :)


Hi Michael,

In this case, only an option is selected in a UI menu ... and no, I cant
modify/add or even read the code on the remote machine.

So I will have to send out the symbol(s) for the down arrow key over the
telnet session.

and thats where I am stuck.
 
S

Sebastian Hungerecker

Arindam said:
Is there any way to represent the arrow keys in the string that I am
sending to the remote machine?

Typing gets in irb and then hitting the four arrow keys (in the order up,
down, right, left) (and then enter) gives me:
"\e[A\e[B\e[C\e[D\n"


HTH,
Sebastian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,007
Latest member
Elvis60357

Latest Threads

Top