Is there a way to emulate the P1 function key in the terminal emulation?

0 votes
asked Oct 22, 2015 by (120 points)

I've got a terminal that I'm trying to screen scrape that has P1 mapped to the num lock key on a windows machine, I don't see P1 anywhere in the function keys. I'm trying to figure out how to replicate what the user is doing.

1 Answer

0 votes
answered Oct 23, 2015 by Pavel Matyska (15,060 points)
edited Oct 23, 2015 by Lukas Matyska


Keys that are not letters or numbers almost always send some code string (mostly in form of escape sequence) to the server. You need to know which escape sequence is send to the server when the mapped key (in your case NumLock) is pressed.

According to this article, it seems you want to send PF1 key, which is SS3 P (ESC O P) escape sequence, which is the same as F1 function key with default options set in our terminal.

So, to send PF1 key (SS3 P), just press F1 key on Windows keyboard.

Alternatively, you can send the escape sequence to the server programmaticaly by calling:


If it does not help, please let us know.

commented Oct 23, 2015 by (120 points)
That is exactly what I needed, thank you.
commented Oct 23, 2015 by Pavel Matyska (15,060 points)
You are welcome.