The rk keysequence command sends a sequence of Roku External Control Protocol (ECP) keypresses in order from a single command. You can use it for navigation flows that need multiple button presses.

See the generated command reference for more information about arguments, options, and defaults.

Synopsis

The following syntax shows how to run the command:

rk keysequence <KEY|KEY:delayMs> [<KEY|KEY:delayMs> ...] [options]

Options

See the generated rk keysequence reference for more information about the options.

Key sequence format

Each step uses one of the following forms:

  • KEY - Uses the default --delay for that step.
  • KEY:delayMs - Overrides the delay for that specific step.

The per-key delay applies after that key press and before the next one. The command ignores the delay for the final key because the final key does not have a next step.

Examples

The following examples show each form of the key sequence.

The following command sends the keys with the default uniform delay of 100 ms:

npx rk keysequence Down Down Down Select

The following command overrides the uniform delay:

npx rk keysequence Down Down Down Select --delay 300

The following command sets a delay for each key:

npx rk keysequence Down:200 Down:200 Down:200 Select

The following command mixes both forms:

npx rk keysequence Home Select:500 Down Down Select

Behavior

The command does the following:

  • Validates all keys and delay values before sending any keypress.
  • Sends keypresses to the selected device in order.
  • Waits for the delay only between keypresses (not after the last key).
  • Returns a summary with:
    • Keys sent
    • Total elapsed time in milliseconds

Error cases

The command reports an error in the following cases:

  • You do not provide any keys.
  • A key name is not valid.
  • The --delay value is less than or equal to 0.
  • A per-key delay is less than or equal to 0.
  • The target device is not found.
  • You do not provide --device and an active device is not set.

Related documentation


Did this page help you?