Skip to main content

KeystrokeCommand

Extends: object

Object representing a keystroke command.

For example, use when performing a VoiceOver command:

import { voiceOver, MacOSModifiers } from "@guidepup/guidepup";

const poundSymbolKeystrokeCommand = {
characters: "3",
modifiers: [MacOSModifiers.Alt],
};

(async () => {
// Start VoiceOver.
await voiceOver.start();

// Send a '#' keystroke.
await voiceOver.perform(poundSymbolKeystrokeCommand);

// Stop VoiceOver.
await voiceOver.stop();
})();

Note: the above is slightly contrived as we could just type a # character using:

await voiceOver.type("#");

See also:

Contents:

keystrokeCommand.characters

The character(s) to send.

Type: string

keystrokeCommand.modifiers

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

Type: Array<string>