Skip to main content

WindowsKeyCodeCommand

Extends: KeyCodeCommand

Object representing a Windows key code command.

For example, use when performing a NVDA command:

import { nvda, WindowsKeyCodes, WindowsModifiers } from "@guidepup/guidepup";

const reportBatteryStatusKeyCodeCommand = {
keyCode: [WindowsKeyCodes.Insert, WindowsKeyCodes.B],
modifiers: [WindowsModifiers.Shift],
description:
"Reports the battery status i.e. whether AC power is in use or the current charge percentage.",
representation: "NVDA-Shift-B",
};

(async () => {
// Start NVDA.
await nvda.start();

// Move to the next item.
await nvda.perform(moveToNextKeyCodeCommand);

// Stop NVDA.
await nvda.stop();
})();

Note: Guidepup provides a number of utility key codes meaning you shouldn't need to construct your own too often! For example, see NVDAKeyCodeCommands for all NVDA key codes.

The above example is also slightly contrived as we could just use the convenience command getter!

await nvda.perform(nvda.keyboardCommands.reportBatteryStatus);

See also:

Contents:

windowsKeyCodeCommand.description

Optional: Description of the action the key code performs.

Type: string

windowsKeyCodeCommand.keyCode

The key code or key codes to send. See WindowsKeyCodes for available key codes.

Type: object | Array<object>

windowsKeyCodeCommand.modifiers

Optional: List of modifier keys to press while sending the key code(s).

Type: Array<WindowsModifiers>

windowsKeyCodeCommand.representation

Optional: Symbolic representation of the key code(s) and modifier keys this command uses.

Type: string