PowerKeys Scripting API
    Preparing search index...

    Interface ClipboardAPI

    interface ClipboardAPI {
        GetText(): Promise<string>;
        SetText(text: string): Promise<void>;
    }
    Index
    • Reads the current text content of the system clipboard. Returns an empty string if no text is available.

      Returns Promise<string>

      Resolves with the current clipboard text, or an empty string when no text is available; rejects if the operating-system clipboard cannot be accessed.

      Returns "" (empty string), never null, when the clipboard holds no text or holds non-text content such as an image.

      const text = await Clipboard.GetText();
      if (text) Console.Log("Clipboard: " + text);

      clipboard

    • Writes text to the system clipboard, replacing its current content.

      Parameters

      • text: string

        The text to place on the clipboard.

      Returns Promise<void>

      Resolves after the operating-system clipboard accepts the text; rejects if it cannot be accessed.

      await Clipboard.SetText("Hello, world!");
      

      clipboard