Making Use Of Adobe Script

Making Use Of Adobe Script

I have been using adobe products such as illustrator and photoshop for years to support my works. The lastest work would be making icons for my Chrome Extensions =]. Adobe script has no doubt saved me a lot of time. And what make me excitied is that the script can be Javascript.

Adobe script is a tool which helps you do something in batch or repetitive. For example, It helps you resize a bunch of photos and save to another path with another names. All the classes are available here:

The following is a script that I created. It is simple and it actually help me save a graphic with size 256×256 in Illustrator into 4 different size of PNG files. It can be any name with the extension JSX. You can also download the file here: SaveIcons(256,128,48,16).jsx

var folder = Folder.selectDialog(); //open file selecting dialog
var document = app.activeDocument;
if(document && folder)
  var options = new ExportOptionsPNG24(); //Basic setup for PNG
  options.antiAliasing = true;
  options.transparency = true;
  options.artBoardClipping = true;

  var file = new File(folder.fsName+"/icon256.png"); // Save original size 256x256

  options.horizontalScale = 50; // Resize to 50%
  options.verticalScale = 50;
  var file = new File(folder.fsName+"/icon128.png"); //Saving 128x128

  options.horizontalScale = 18.75;  // Resize to 18.75%
  options.verticalScale = 18.75;
  var file = new File(folder.fsName+"/icon048.png"); // Saving 48x48

  options.horizontalScale = 6.25;  // Resize to 6.25%
  options.verticalScale = 6.25;
  var file = new File(folder.fsName+"/icon016.png"); // Saving 16x16