Keystroke Methods

Some keyboard keystroke combinations are not sent to the remote machine because they are intended to work only on the local environment.

Through Thinfinity® Remote Desktop Server SDK library it is possible to send any keystroke combination to the server by using a list of methods available in any Thinfinity® Remote Desktop Server instance you create.

The table below lists and describes those methods.

The first four methods are general base methods that once combined could generate any keystroke sequence.

The last eight methods are commonly used key combinations that might be useful to enhance functionality to your Thinfinity® Remote Desktop Server integration.

Usage Examples:

The next examples are JavaScript methods which are intended to show you a couple of usage cases for combining Thinfinity® Remote Desktop Server Library Keystroke methods.

Example 1 - Enter:

This first example shows you how to send a single keystroke, by sending its key code on the sendKeyStroke method argument.

function sendEnter() {
 if (mythinrdp) {
 mythinrdp.sendKeyStroke(13);
 }
 }

Example 2 - Select next word / Select Line:

Observe on these next examples how to use the combination of "keydown" followed by "keyup" keys in order to select the next word inside of a text.

These next two examples simulate a combinations of keys pressed all together.

Remember that the sendKeyDown method has to be followed, at some point, by the sendKeyUp method, in order to release the key. If you only call the sendKeyDown method it is as if a key was constantly pressed on the keyboard.

function selectNextWord() {
 if (mythinrdp) {
 mythinrdp.sendKeyDown(0x11); //CTRL
 mythinrdp.sendKeyDown(0x10); //SHIFT
 mythinrdp.sendKeyStroke(39); // RIGHT ARROW
 mythinrdp.sendKeyUp(0x10); //SHIFT
 mythinrdp.sendKeyUp(0x11); //CTRL
 }
 }
function selectLine() {
 if (mythinrdp) {
 mythinrdp.sendKeyDown(0x10); //SHIFT
 mythinrdp.sendKeyStroke(40); // DOWN ARROW
 mythinrdp.sendKeyUp(0x10); //SHIFT
 }
 }

Example 3 - Send a plain text:

This next example sends a plain text followed by an 'enter' to the remote environment.

function sendText() {
 if (mythinrdp) {
 mythinrdp.sendText("This is a test...");
 sendEnter();
 }
}

Last updated