Copy link to clipboard
Copied
Hi,
Can you please provide the Extendacript code to save clipboard image into local system/folder.
I want to save clipboard image inot my local machine so please provide the extendscript code/javascript code
Thank You..!!
Copy link to clipboard
Copied
I don't think you will be able to do this directly using Extendscript. You might have to use OS scripting i.e. Applescript on MAC and VBScript on WIN.
-Manan
Copy link to clipboard
Copied
So this is hacky at best but it works with images copied to your system clipboard. Tested with copying images from a website and from within the Preview app on a Mac. Screencast video shows the script in action.
// make a new document and paste the image
var doc = app.documents.add(DocumentColorSpace.RGB);
app.executeMenuCommand("paste");
var img = doc.pageItems[0];
// resize the artboard to match the image size
app.executeMenuCommand("Fit Artboard to artwork bounds");
// setup export file info
var fpath = Folder.desktop + "/EXAMPLE/"; // folder where JPEG will be saved
var fname = "imageExport.jpeg"; // name of saved JPEG
var f = new File(fpath + "/" + fname);
// export the file as a JPEG
var exportOptions, exportType;
exportOptions = new ExportOptionsJPEG();
exportOptions.qualitySetting = 100;
doc.exportFile(f, ExportType.JPEG, exportOptions);