Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Hi, on the "more like this" panel to your right there another post, see if it helps
Copy link to clipboard
Copied
Thanks for the links Carlos, but I'm on a pc, so I need a script/plugin that will run for me.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Yeah I've tried running the CollectForOutput script but I get an error message that reads "ActiveX component can't create object: 'Illustrator .Application'". So, not sure what that means.
Copy link to clipboard
Copied
one possible reason is you might not be an administrator, even if you are. Close illustrator and right click on it and chose "run as administrator", then try running the script.
Copy link to clipboard
Copied
Nope, that didn't fix it. 😕
Copy link to clipboard
Copied
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.");
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi, I had some questions about the above script, which is working great,....
- How can I get this to overwrite a previously saved AI file?
- How can I save the file with pdf compatibility option unchecked, but embed ICC profiles checked?
Thanks!
Copy link to clipboard
Copied
Untested, but I think all you need to do is add a IllustratorSaveOption object:
// save as new file packaged_file = File(export_folder + "/" + filename + FILE_SUFFIX + extension); var save_options = new IllustratorSaveOptions(); save_options.embedICCProfile = true; save_options.pdfCompatible = false doc.saveAs(packaged_file, save_options); doc.close();
Good luck. // p
Copy link to clipboard
Copied
Sweet pwever, thanks so much!
Larry, you're correct, but I'd like to utilize this packaging script because I work with other designers and share links/graphics at times.
Copy link to clipboard
Copied
I apologize for my "noobiness"...
How do we use this.
I know how to use scripts but I am not sure how to use your text to apply your script. Can you PM me the script file?
I tried using the script console tool but didnt have much luck.
Thanks!
Copy link to clipboard
Copied
hey pwever,
Wow you're a lifesaver.. had the same problem as andymc7. Btw, do you know how I can into the script for it to not only save an ai. copy but also a pdf. and eps. copy while collecting? Thanks in advance.
Copy link to clipboard
Copied
Fuzzyteddy,
here is a version that should export an AI, PDF and EPS file.
Hope it helps // p
Download at https://www.dropbox.com/s/lomfrkj7rt94sqk/Package-extra.js
or copy below.
// 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 Illustrator file
packaged_file = File(export_folder + "/" + filename + FILE_SUFFIX + extension);
doc.saveAs(packaged_file, this.getAIOptions() );
// PDF export
var pdf_target_file = File(export_folder + "/" + this.changeExtension(doc.name, ".pdf"));
doc.saveAs( pdf_target_file, this.getPDFOptions() );
// EPS export
var eps_target_file = File(export_folder + "/" + this.changeExtension(doc.name, ".eps"));
doc.saveAs( eps_target_file, this.getEPSOptions() );
// close the document and re-open the original file
doc.close();
app.open(File(original_file));
} else {
alert("Unable to create the assets folder.");
}
function getAIOptions() {
var options = new IllustratorSaveOptions();
options.embedICCProfile = true;
options.pdfCompatible = false;
return options;
}
function getEPSOptions() {
var options = new EPSSaveOptions();
options.cmykPostScript = true;
options.embedAllFonts = true;
return options;
}
function getPDFOptions() {
var options = new PDFSaveOptions();
options.pDFPreset = "[Smallest File Size]";
options.compatibility = PDFCompatibility.ACROBAT7;
// general
options.preserveEditability = false;
options.generateThumbnails = false;
options.optimization = true;
options.viewAfterSaving = false;
options.acrobatLayers = false;
// compression
options.compressArt = true;
options.colorCompression = CompressionQuality.AUTOMATICJPEGMEDIUM;
return options;
}
function changeExtension(filename, new_ext) {
var new_name = "";
if (filename.indexOf('.') < 0) {
new_name = filename + new_ext;
} else {
var dot = filename.lastIndexOf('.');
new_name += filename.substring(0, dot);
new_name += new_ext;
}
return new_name;
}
Copy link to clipboard
Copied
Hi pwever,
Thanks for creating the script for me... unfortunately my pc can't seem to run the javascript file
but it runs visual basic scripts. Is there a way you can convert the current script to visual basic for me? You'd would be doing me a huge favour and I thank you in advance if you're free to help me ![]()
Copy link to clipboard
Copied
What are you doing with the file…? The syntax is ExtendScript and should run on both platforms… At a glance I can't see anything that may be OS specific… IMO better to sort any issue than translate…
Copy link to clipboard
Copied
Hi pwever,
Sorry, I copied the text wrongly... and totally missed the download link you posted... I've downloaded the file and it works perfectly.. Sorry for troubling you and Thanks a million for helping me with this script! ![]()
Copy link to clipboard
Copied
That was easier me thinks…
You can C&P from the forum but you need to save in plain text depending on what you use… AI will not see *.jsxbin
Copy link to clipboard
Copied
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.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more