Highlighted

Can you help me modify the script thank you

Community Beginner ,
Jul 24, 2020

Copy link to clipboard

Copied

Refer to the script code below and modify it to export jpg to the current ai file path. Export according to the drawing board. Resolution 150

 

 

 

 

 

var pngPath = activeDocument.fullName.toString();
pngPath = pngPath.substring(0,pngPath.lastIndexOf("."));
exportFileToPNG24(pngPath);
function exportFileToPNG24 (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsPNG24();
var type = ExportType.PNG24;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.transparency = false;
exportOptions.artBoardClipping = true;
exportOptions.saveAsHTML = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}




if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
for(i=0;i<doc.artboards.length;i++){
var pngPath = activeDocument.fullName.toString();
pngPath = pngPath.substring(0,pngPath.lastIndexOf("."))+doc.artboards[i].name;
doc.artboards.setActiveArtboardIndex(i);
exportFileToPNG24(pngPath);
}

function exportFileToPNG24 (dest) {
var exportOptions = new ExportOptionsPNG24();
var type = ExportType.PNG24;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.transparency = false;
exportOptions.artBoardClipping = true;
exportOptions.saveAsHTML = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

To add more information, imageCapture only works to export into PNG format. For JPEg, please refer the link below

https://community.adobe.com/t5/illustrator/export-jpg-as-300-ppi/m-p/11244323?page=1#M183146

TOPICS
Scripting

Views

107

Likes

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

Can you help me modify the script thank you

Community Beginner ,
Jul 24, 2020

Copy link to clipboard

Copied

Refer to the script code below and modify it to export jpg to the current ai file path. Export according to the drawing board. Resolution 150

 

 

 

 

 

var pngPath = activeDocument.fullName.toString();
pngPath = pngPath.substring(0,pngPath.lastIndexOf("."));
exportFileToPNG24(pngPath);
function exportFileToPNG24 (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsPNG24();
var type = ExportType.PNG24;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.transparency = false;
exportOptions.artBoardClipping = true;
exportOptions.saveAsHTML = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}




if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
for(i=0;i<doc.artboards.length;i++){
var pngPath = activeDocument.fullName.toString();
pngPath = pngPath.substring(0,pngPath.lastIndexOf("."))+doc.artboards[i].name;
doc.artboards.setActiveArtboardIndex(i);
exportFileToPNG24(pngPath);
}

function exportFileToPNG24 (dest) {
var exportOptions = new ExportOptionsPNG24();
var type = ExportType.PNG24;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.transparency = false;
exportOptions.artBoardClipping = true;
exportOptions.saveAsHTML = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

To add more information, imageCapture only works to export into PNG format. For JPEg, please refer the link below

https://community.adobe.com/t5/illustrator/export-jpg-as-300-ppi/m-p/11244323?page=1#M183146

TOPICS
Scripting

Views

108

Likes

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
Jul 24, 2020 0
Community Beginner ,
Jul 24, 2020

Copy link to clipboard

Copied

Hello,
the script does not know how to set DPI
you can call a third-party utility
or call Action (but there are subtleties)

 

var pngPath = activeDocument.fullName.toString();
pngPath = pngPath.substring(0,pngPath.lastIndexOf("."));

exportFileToJPEG(pngPath);

function exportFileToPNG24 (dest) {
  if ( app.documents.length > 0 ) {
    var exportOptions = new ExportOptionsPNG24();
    var type = ExportType.PNG24;
    var fileSpec = new File(dest);
    exportOptions.antiAliasing = false;
    exportOptions.transparency = false;
    exportOptions.artBoardClipping = true;
    exportOptions.saveAsHTML = true;
    app.activeDocument.exportFile( fileSpec, type, exportOptions );
  }
}

function exportFileToJPEG (dest) {
  if ( app.documents.length > 0 ) {
    var exportOptions = new ExportOptionsJPEG();
    var type = ExportType.JPEG;
    var fileSpec = new File(dest);
    exportOptions.antiAliasing = false;
    exportOptions.qualitySetting = 100;
    exportOptions.horizontalScale = 100;
    exportOptions.verticalScale = 100;
    exportOptions.artBoardClipping = true;
    app.activeDocument.exportFile( fileSpec, type, exportOptions );
  }
}



if ( app.documents.length > 0 ) {
  var doc = app.activeDocument;
  for (i = 0; i < doc.artboards.length; i++) {
    var pngPath = activeDocument.fullName.toString();
    pngPath = pngPath.substring(0, pngPath.lastIndexOf(".")) + doc.artboards[i].name;
    doc.artboards.setActiveArtboardIndex(i);
    exportFileToJPEG(pngPath);
  }
}

 

 

 

Likes

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
Reply
Loading...
Jul 24, 2020 1
Community Beginner ,
Jul 24, 2020

Copy link to clipboard

Copied

Hello, thank you very much for your help. It would be great if you can set up DIP or who would hope to help me. Thank you very much

Likes

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
Reply
Loading...
Jul 24, 2020 0
Explorer ,
Jul 25, 2020

Copy link to clipboard

Copied

Here is another post with answer how to set dpi settings.
So your code will be something like this:

if ( app.documents.length > 0 ) {
  for (i = 0; i < doc.artboards.length; i++) {
    var Path = activeDocument.fullName.toString();
    Path = Path.substring(0, Path.lastIndexOf(".")) + doc.artboards[i].name + ".jpg";
    doc.artboards.setActiveArtboardIndex(i);
    var activeAB = doc.artboards[doc.artboards.getActiveArtboardIndex()];
    exportFile(Path);
  }
}

function exportFile (dest) {
      var exportOptions = new ImageCaptureOptions();
      var fileSpec = new File(dest);
      exportOptions.antiAliasing = true;
      exportOptions.resolution = 150;
      doc.imageCapture( fileSpec, activeAB.artboardRect, exportOptions );
  }

 

Likes

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
Reply
Loading...
Jul 25, 2020 0
Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

Thank you

Likes

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
Reply
Loading...
Jul 27, 2020 0
Adobe Community Professional ,
Jul 27, 2020

Copy link to clipboard

Copied

Hi,

To add more information, imageCapture only works to export into PNG format. For JPEg, please refer the link below

https://community.adobe.com/t5/illustrator/export-jpg-as-300-ppi/m-p/11244323?page=1#M183146

Best regards

Likes

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
Reply
Loading...
Jul 27, 2020 0