Neutralino.clipboard
Neutralino.clipboard namespace offers functions to access system clipboard.
clipboard.getFormat()
Returns the current data format of the system clipboard.
Return String (awaited):
Clipboard format: text, image, or unknown.
let format = await Neutralino.clipboard.getFormat();
console.log(`Format: ${format}`);
clipboard.writeText(text)
Writes text into the system clipboard.
Parameters
textString: Text to store into the system clipboard.
await Neutralino.clipboard.writeText('Test value');
clipboard.writeHTML(html)
Writes HTML into the system clipboard.
Parameters
htmlString: HTML to store into the system clipboard.
await Neutralino.clipboard.writeHTML('<p style="color:red;">Formatted Text</p>');
clipboard.writeImage(image)
Writes image into the system clipboard.
Input Object: ClipboardImage
width: Number: Image width.height: Number: Image height.bpp: Number: Bits per pixel (BPP).bpr: Number: Bytes Per Row (BPR).redMask: Number: Red mask.greenMask: Number: Green mask.blueMask: Number: Blue mask.redShift: Number: Red shift.greeShift: Number: Green shift.blueShift: Number: Blue shift.data: ArrayBuffer: Raw RGBA binary data of the image in an array buffer.
let image = prepareClipboardImage();
await Neutralino.clipboard.writeImage(image);
clipboard.readText()
Reads and returns text from system clipboard.
Return String (awaited):
Stored text from the system clipboard.
let clipboardText = await Neutralino.clipboard.readText();
console.log(`Text: ${clipboardText}`);
clipboard.readHTML()
Reads and returns HTML from system clipboard.
Return String (awaited):
Stored HTML from the system clipboard.
let clipboardHTML = await Neutralino.clipboard.readHTML();
console.log(`HTML: ${clipboardHTML}`);
clipboard.readImage(format)
Reads and returns an image from system clipboard.
Parameters
formatString (optional): Pixel data format. Accepted values arergb,rgba,argb, andbgra. By default, the function uses the default platform-specific pixel data format.
Return Object (awaited):
Returns ClipboardImage object that has the same
properties as in the writeImage() function.
let clipboardImage = await Neutralino.clipboard.readImage();
console.log(`Image: ${clipboardImage}`);