string | The string is put as plain text. |
Element DocumentFragment | The HTML is put as formatted text. |
HTMLImageElement SVGImageElement HTMLCanvasElement OffscreenCanvas | The image content is put as a bitmap |
Array of paths | Each path is put as a file/folder. You must ensure these paths point to existing files/folders, otherwise the operating system will complain when you try to paste them. |
ACtl.setClipboard('Hello, world!') ;
//When you paste this text in any text field that supports
//formatted text, you'll get blue text in large Arial font.
ACtl.setClipboard({html: '<font size=6 color=blue face=Arial>Hello</font>'}) ;
//This script must run in the page you want to copy
if( await ACtl.setClipboard( document.body ) )
alert('Webpage copied successfully') ;
else
alert('Copy operation failed') ;
//This file can then be pasted in any place that accepts files,
//like a file explorer, a file editor, etc.
ACtl.setClipboard(['C:/Pictures/Photo.jpg']) ;
let files = [
'C:/Pictures/Photo1.jpg',
'C:/Pictures/Photo2.jpg',
'C:/Pictures/Vacations',
] ;
ACtl.setClipboard(files) ;
//Get the image file as a binary string
let fileContent = await ACtl.getFile('C:/Pictures/Photo.jpg', 'binary') ;
//Put the file content as an image
ACtl.setClipboard({image: fileContent}) ;