• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to save clipboard image into local folder as jpeg in extendscript

Community Beginner ,
May 18, 2023 May 18, 2023

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..!!

TOPICS
Experiment , How-to , Scripting , Third party plugins , Tools

Views

439

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 18, 2023 May 18, 2023

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 18, 2023 May 18, 2023

Copy link to clipboard

Copied

LATEST

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.

Screen Shot 2023-05-18 at 11.16.57.gif

// 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);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines