Skip to content

Send Key ​

Send complete key events, automatically handles press and release, supports single keys, multiple keys, and combination keys.

⚠️ Note: sendKey can only input keyboard characters (English letters, digits, and common symbols). It does not support other languages or arbitrary text. To send any text to the device, see Send Text.

Interface Description ​

Interface Type ​

sendKey

Parameters ​

ParameterTypeRequiredDescription
deviceIdstring✅Device ID
keystring✅Key (supports + concatenation)
fnkeystring❌Function key/modifier key (such as CTRL, SHIFT, etc., supports + concatenation)

Return Value ​

javascript
true  // Returns true on successful operation

Basic Usage ​

Input Single Character ​

javascript
// Input letter A
await apiInvoke('sendKey', {
    deviceId: 'P72578581E07',
    key: 'A'
});

Input Multiple Characters ​

javascript
// Input "HELLO"
await apiInvoke('sendKey', {
    deviceId: 'P72578581E07',
    key: 'HELLO'
});

// Equivalent to inputting H, E, L, L, O sequentially

Combination Key Usage ​

With Modifier Keys ​

javascript
// COMMAND + C (Copy)
await apiInvoke('sendKey', {
    deviceId: 'P72578581E07',
    key: 'C',
    fnkey: 'COMMAND'
});

// COMMAND + V (Paste)
await apiInvoke('sendKey', {
    deviceId: 'P72578581E07',
    key: 'V',
    fnkey: 'COMMAND'
});

// COMMAND + A (Select All)
await apiInvoke('sendKey', {
    deviceId: 'P72578581E07',
    key: 'A',
    fnkey: 'COMMAND'
});

Cooperation: try.catch@foxmail.com