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

Exporting an AI Symbol Library

Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Hi, I was just wondering if it's possible to export all of the images in an AI symbol Library into individual artboards or files. I have a symbol library with a couple of hundred icons in it, and I was these as individual artboards or files.

Thanks.

Leah.

TOPICS
Scripting

Views

684

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 ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Looks like a task for a script. Maybe the scripting gods here have ideas.

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
Guide ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

Artboards are limited to 100 per document and one would be loathe to creating hundreds of files. So the script will distribute the symbol items, each on its artboard, across separate documents, 100 per document. 

 

The symbols library file should be somewhere like

C:\Program Files (x86)\Adobe\Adobe Illustrator CS6\Presets\en_GB\Symbols

 

var file1 = File.openDialog("Open Symbol Library File");
app.open(file1);
var doc1 = app.documents[file1.displayName];
var y = 0, x = 0, row = 1;
function createSymbolItems() {
    for (var i = 0; i < doc1.symbols.length; i++) {
        symbolItem1 = doc1.symbolItems.add(doc1.symbols[i]);
        symbolItem1.left = x, symbolItem1.top = y;
        symbolItem1.width = 50, symbolItem1.height = 50;
        if (i < (10 * row) - 1) {
            x += 50;
        }  else {
            x = 0;
            y -= 50;
            row++;
        }
    }
}
createSymbolItems();
var start = doc1.symbolItems.length - 1;
function distribute(i) {
    doc1.activate();
    app.selection = null;
    for (var j = i - 100; i > (j > -1 ? j : -1); i--){
        doc1.symbolItems[i].selected = true;
    }
    app.copy();
    var doc2 = app.documents.add();
    app.paste();
    for (var k = 0; k < doc2.symbolItems.length; k++){
        if (k == 1) {
            doc2.artboards[0].remove();
        }
        doc2.artboards.add(doc2.symbolItems[k].visibleBounds);
    }
    start = start - 100;
    if (start > 0) {
        distribute(start);
    }
}
distribute(start);
doc1.close(SaveOptions.DONOTSAVECHANGES);

Untitled1.png

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
Community Expert ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

Femke,

 

just a hint: In more recent versions of Illustrator one can have up to 1000 artboards per document.

 

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
Guide ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

@Kurt Gold  Thanks.  That should make the script straightforward.  (I cannot test it though.)

 

var file1 = File.openDialog("Open Symbol Library File");
app.open(file1);
var doc1 = app.documents[file1.displayName];
var y = 0, x = 0, row = 1;
for (var i = 0; i < doc1.symbols.length; i++) {
    symbolItem1 = doc1.symbolItems.add(doc1.symbols[i]);
    symbolItem1.left = x, symbolItem1.top = y;
    symbolItem1.width = 50, symbolItem1.height = 50;
    symbolItem1.selected = true;
    if (i < (10 * row) - 1) {
        x += 50;
    }  else {
        x = 0;
        y -= 50;
        row++;
    }
}
app.copy();
var doc2 = app.documents.add();
app.paste();
for (var k = 0; k < doc2.symbolItems.length; k++){
    doc2.artboards.add(doc2.symbolItems[k].visibleBounds);
}
doc2.artboards[0].remove();
doc1.close(SaveOptions.DONOTSAVECHANGES);

 

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
Community Expert ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

Femke, I think both of your approaches will have to be slightly modified in order to use them in the latest (German) version of Illustrator.

 

After opening the .ai file that contains the symbols, both scripts quit running with an alert (Error 21: undefined is no object). It is referring to line 6 (first approach) and line 5 (second approach):

 

-> for (var i = 0; i < doc1.symbols.length; i++) {

 

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
Guide ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

Hmm. It's an innocuous line, so I presume that the problem is with reading the file's name.  What about changing line 3 to

 

var doc1 = app.activeDocument;

 

So the script will look like

 

var file1 = File.openDialog("Open Symbol Library File");
app.open(file1);
var doc1 = app.activeDocument;
var y = 0, x = 0, row = 1;
for (var i = 0; i < doc1.symbols.length; i++) {
    symbolItem1 = doc1.symbolItems.add(doc1.symbols[i]);
    symbolItem1.left = x, symbolItem1.top = y;
    symbolItem1.width = 50, symbolItem1.height = 50;
    symbolItem1.selected = true;
    if (i < (10 * row) - 1) {
        x += 50;
    }  else {
        x = 0;
        y -= 50;
        row++;
    }
}
app.copy();
var doc2 = app.documents.add();
app.paste();
for (var k = 0; k < doc2.symbolItems.length; k++){
    doc2.artboards.add(doc2.symbolItems[k].visibleBounds);
}
doc2.artboards[0].remove();
doc1.close(SaveOptions.DONOTSAVECHANGES);

 

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
Community Expert ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

This version works fine, Femke.

 

Thanks for your very good contribution.

 

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
Community Beginner ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

LATEST

thank you so much everyone. I'll give this a try. 

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
Community Expert ,
May 01, 2021 May 01, 2021

Copy link to clipboard

Copied

Very good and useful, Femke!

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