PS in an AS/JXA script, the theClipboard method of standard additions should, of course, also yield any textual version of the available pasteBoard contents:
Applescript
use scripting additions
the clipboard
JavaScript for Automation
(() => {
// standardAdditions :: () -> Library Object
const standardAdditions = () =>
Object.assign(
Application.currentApplication(), {
includeStandardAdditions: true
}
);
return standardAdditions().theClipboard();
})();