Obviously this only be done from the Windows clipboard contents. It works as intended.
function CopyToClipboard (theString) { //=== Copy string to clipboard =============================
// Arguments theString: string to be copied to clipboard
// Called by FMbiblioCallBibapp
// Reference Based on Rick Quatro's method
var oDoc, tRange, masterPage, textFrame, oPgf, textLoc, PT = 65536;
// Create a textframe with a paragraph on the first masterpage (which always exists)
tRange = new TextRange;
oDoc = app.ActiveDoc;
masterPage = oDoc.FirstMasterPageInDoc; // Get first master page in document.
textFrame = oDoc.NewTextFrame (masterPage.PageFrame); // Add a temporary text frame to the master page.
textFrame.Width = 480 * PT;
oPgf = textFrame.FirstPgf;
textLoc = new TextLoc (oPgf, 0);
oDoc.AddText (textLoc, theString); // write string into this paragraph
tRange.beg.obj = oPgf; // select this paragraph
tRange.beg.offset = 0;
tRange.end.obj = oPgf;
tRange.end.offset = theString.length;
oDoc.TextSelection = tRange;
oDoc.Copy (0); // copy selection to clipboard not interactive
textFrame.Delete (); // delete the text frame
} // --- end CopyToClipboard