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

AI Scripting experts? Need some help please! (exporting layers + art-boards > new files)

Explorer ,
Mar 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

So I have a .ai file with many layers on separate 1920x1080 artboards; what I need is a script to export every top layer into a separate .ai file on a single 1920x1080 artboard (so I can later fix/import into AE)

*Here is a base Script* Can someone help me edit this? As this script only creates new AI files with all the same artboard/layers; but just hides the ones I don't need.

//////////////Start

var doc = app.activeDocument;

 

if (documents.length > 0){

     

    // Create the illusrtratorSaveOptions object to set the AI options

    var saveOpts = new IllustratorSaveOptions();

 

    // Setting IllustratorSaveOptions properties.

    saveOpts.embedLinkedFiles = true;

    saveOpts.fontSubsetThreshold = 0.0

    saveOpts.pdfCompatible = true

     

        if (doc.saved==false) doc.save();

     

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

            if (doc.layers.locked == false) doc.layers.visible = false;

        fullDocName = doc.fullName;

        var param = doc.name.split('.');

        realDocName = param[0];

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

            if (i-1<0) doc.layers.visible = true;

            else {

                doc.layers[i-1].visible = false;

                doc.layers.visible = true;

            }

            if (doc.layers.locked == false) { 

                docName = realDocName+doc.layers.name+".ai"; 

                var saveName = new File ( doc.path + "/" + docName );

                doc.saveAs( saveName, saveOpts );

            }

        }

        doc.close(SaveOptions.DONOTSAVECHANGES);

        doc = null;

        app.open (fullDocName);

    }

/////////End

Questionable link removed by moderator.

TOPICS
Scripting

Views

209

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
no replies

Have something to add?

Join the conversation
Adobe