I have difficulty using JavaScript in ScriptEditor
AppleScript copy image to clipboard by path like this
set image to POSIX file ("/Users/lll00lll/Library/Documents/temp.jpg")
set the clipboard to image
But how to translate above AppleScript code to JavaScript?
JavaScript like this can copy string to clipboard but not image or file
var app = Application('Script Editor');
app.includeStandardAdditions = true;
app.setTheClipboardTo(str);
or use Objective-C ?but i don't how to edit it to "generalPasteboard.setData"
$.NSPasteboard.generalPasteboard.clearContents;
$.NSPasteboard.generalPasteboard.setStringForType($(str), $.NSPasteboardTypeString);