Documentation
On this page

Function · Desktop Services

writeClipboardText

Writes plain text to the desktop clipboard.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
writeClipboardText(value: string): Promise<void>

Parameters

NameTypeDescription
valuestringText to place on the clipboard.

Returns

Promise<void> — A promise completed after the clipboard is updated.

Remarks

Clipboard access is scheduled through the active desktop window and may require platform permission.

Throws

  • When no desktop window or system clipboard is available, or the platform rejects clipboard access.

Examples

TypeScript
import { writeClipboardText } from "@sharpts/gui";

await writeClipboardText("Copied from SharpTS");

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1652 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.