Tampermonkey® by Jan Biniok

GM_setClipboard(data, info, cb)

GM_setClipboard sets the text of the clipboard to a specified value.

The function takes a parameter "data", which is the string to set as the clipboard text, a parameter "info" and an optional callback function "cb".

"info" can be just a string expressing the type text or html or an object like "cb" is an optional callback function that is called when the clipboard has been set.

{
    type: 'text',
    mimetype: 'text/plain'
}
GM_setClipboard("This is the clipboard text.", "text", () => console.log("Clipboard set!"));
await GM.setClipboard("This is the newer clipboard text.", "text");
console.log('Clipboard set again!');