Seems like this should be obvious, but how do I send arrow key presses to a process using Expect.pm? Does it depend on the terminal type I am using (vt100) or do I send keyboard scancodes?
TIA.
If you want to send a special key like the right arrow button or the return/enter key, you would have to enclose it in curly braces {} . For example, {right} or {return} corresponding to the aforementioned examples. For more information about this, please see this documentation link.
For smaller keyboards and many laptop keyboards, the arrow keys may be moved below Enter and the right Shift . Also, some compact keyboards may move the arrow keys to the keypad and switch between the keypad and arrow keys by pressing the Num Lock key.
To detect the arrow key when it is pressed, use onkeydown in JavaScript. The button has key code. As you know the left arrow key has the code 37. The up arrow key has the code 38 and right has the 39 and down has 40.
Arrow keys are typically located at the bottom of the keyboard to the left side of the numeric keypad, usually arranged in an inverted-T layout but also found in diamond shapes and linear shapes. Arrow keys are commonly used for navigating around documents and for playing games.
It does indeed depend on your current TERM environment variable. Once that's set correctly (say VT220 or linux), then arrow keys are
up: "\c[[A"
down: "\c[[B"
left: "\c[[D"
right: "\c[[C"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With