Send Key
Send complete key events, automatically handles press and release, supports single keys, multiple keys, and combination keys.
⚠️ Note:
sendKeycan 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
sendKeyParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
deviceId | string | ✅ | Device ID |
key | string | ✅ | Key (supports + concatenation) |
fnkey | string | ❌ | Function key/modifier key (such as CTRL, SHIFT, etc., supports + concatenation) |
Return Value
javascript
true // Returns true on successful operationBasic 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 sequentiallyCombination 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'
});