javascript - Set a local image into clipboard contents -
i've looked everywhere found solutions revolving online images. i'm dealing local image directory: c:\users\me\desktop\venice.jpg
i need javascript or vbscript set image (not path) clipboard, can paste image application word or ms paint.
i've found following code, don't know how adapt use. there no internet access required. simple, local javascript function need. have no applicable html don't see substitute "div" below. great!! thank you.
var div = document.getelementbyid('divtocopy'); div.contenteditable = 'true'; var controlrange; if (document.body.createcontrolrange) { controlrange = document.body.createcontrolrange(); controlrange.addelement(div); controlrange.execcommand('copy'); } div.contenteditable = 'false';
in powershell copying image file clipboard simple this:
add-type -assembly system.windows.forms add-type -assembly system.drawing $imgpath = 'c:\users\me\desktop\venice.jpg' $img = [drawing.image]::fromfile($imgpath) [windows.forms.clipboard]::setimage($img)
Comments
Post a Comment