Skip to main content
Known Participant
April 11, 2012
Question

Ai Packaging Script

  • April 11, 2012
  • 3 replies
  • 15934 views

Ok.. I'm sure this has been posted before (already searched, didn't find however), but does a file packaging script exist for AI? (one that collects all linked images and fonts and places them in one place) This would be IMMENSELY helpful to me if anyone can post a link to one or even be willing to write it.

OS: W7

AI Version: CS5

Thanks in advance!

This topic has been closed for replies.

3 replies

Larry G. Schneider
Community Expert
Community Expert
May 9, 2012

The real packaging script for AI is a Press-Ready or High Quality output PDF. It does everything that a script would do and everything is in one file.

Participant
April 19, 2012

Here is a package script I have been using. It collects linked files, but not fonts. Instead it ask whether or not you want to outline all text elements.

Only tested on a Mac though. Good luck. // Pascal

// This script exports a package of the currently active document.

// Choose output folder, and indicate whether or not you want to

// outline text elements.

const FILE_SUFFIX = "-export";

const ASSET_SUFFIX = "-assets";

var doc = app.activeDocument;

if (!doc.saved) doc.save();

var original_file = doc.fullName;

// create text outlines if desired.

if (confirm("Create text outlines?", true)) { while (doc.textFrames.length != 0) { doc.textFrames[0].createOutline(); }}

// collect all linked files

var export_folder = Folder.selectDialog("Choose a folder to package into.");

var arr = doc.name.split(".");

var extension = "";

if (arr.length>1) extension = "." + arr.pop();

var filename = arr.join(".");

var assets_folder = new Folder(export_folder + "/" + filename + ASSET_SUFFIX);

if (assets_folder.exists || assets_folder.create()) {

          var i, in_file, out_file;

          for (i=0;i<doc.placedItems.length;i++) {

                    in_file = doc.placedItems.file;

                    out_file = File(assets_folder+"/"+in_file.name);

                    in_file.copy(out_file);

                    doc.placedItems.file = out_file;

          }

          for (i=0;i<doc.rasterItems.length;i++) {

                    if (doc.rasterItems.embedded) continue;

                    in_file = doc.rasterItems.file;

                    out_file = File(assets_folder+"/"+in_file.name);

                    in_file.copy(out_file);

                    doc.rasterItems.file = out_file;

          }

          // save as new file

          packaged_file = File(export_folder + "/" + filename + FILE_SUFFIX + extension);

          doc.saveAs(packaged_file);

          doc.close();

          // re-open the original file

          app.open(File(original_file));

} else {

          alert("Unable to create the assets folder.");

}

Andymc7Author
Known Participant
April 19, 2012

Thanks so much! this will certainly get me on my way. the CollectForOutput script that comes with AI doesn't let you choose the output folder, but makes one for you, so this is better.

CarlosCanto
Community Expert
Community Expert
April 11, 2012

Hi, on the "more like this" panel to your right there another post, see if it helps

http://forums.adobe.com/message/4210592#4210592

Andymc7Author
Known Participant
April 11, 2012

Thanks for the links Carlos, but I'm on a pc, so I need a script/plugin that will run for me.

CarlosCanto
Community Expert
Community Expert
April 11, 2012

in that thread, it is mentioned there's a script that ships with illustrator that collects the ai file and the placed images, but not the fonts.