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

Turn selected AI sublayers into top-level layers?

Adobe Employee ,
Jun 05, 2008 Jun 05, 2008

Copy link to clipboard

Copied

Hi, all!

I wanted to ask if by chance any of the scripting gurus here happen to have written an AI script that will take a number of selected sublayers/sub-sublayers and move them so they become top-level layers?
I am really needing this very badly, given that After Effects can only handle AI layers as separate entities. So I find myself moving tens, even hundreds of nested sublayers to the top level all the time.
Is it possible this script exists already?
TOPICS
Scripting

Views

116.4K

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

correct answers 1 Correct answer

LEGEND , Aug 15, 2008 Aug 15, 2008
This .zip archive contains an AICS3 file and a draft script.

Install the script.
Launch Illustrator.
Open the AI file.

Note that an expanded Blend is on the Artboard. Each object from the former Blend is on its own Layer. The Layers palette contains 100 or so Layers, all named sequentially and nested 10 levels deep.

Run the script a few times. Each time the script runs, an alert tells you the number of existing top-level Layers. It then moves any sublayers nested inside each of those top-leve...

Votes

Translate

Translate
Community Beginner ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hi Carlos/Anyone who can help!

Is there any chance you could help me? I'm quite new to illustrator and I can't get the script to work. I'm trying to import a project into after effects but I've got alot of items that I've named and have now released to layers - but I keep getting this error when I run the script:

Screen Shot 2017-08-03 at 15.27.34.png

It looks like the similar problem to the person earlier in the thread that was using the text only script, but this is the updated script for all objects: this is the script I have in textedit:

Screen Shot 2017-08-03 at 15.30.57.png

Thanks!!!!

Mark

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 ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

UPDATE! - I've somehow managed to just randomly delete lines in the code until it worked. For anyone who needs it, the code that worked for me is:

// http://forums.adobe.com/thread/877442
// http://forums.adobe.com/thread/1408454?tstart=0
// carlos canto // 09/26/14
// https://forums.adobe.com/thread/287812
var idoc = app.activeDocument;
var ilayer = idoc.activeLayer;
for (i=0; i<ilayer.layers.length; i++) {
    var sublayer = ilayer.layers;
    sublayer.name = sublayer.pageItems[0].name;
}

Here is the .jsx file incase anyone has the same issue I had:

https://www.dropbox.com/s/7nc46odgusx3nv9/Renaming%20Script%20for%20Illustrator.jsx?dl=0

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 ,
Nov 29, 2017 Nov 29, 2017

Copy link to clipboard

Copied

Hello,

I need an illustrator script that can find layers and sublayers by name,

and select just those isolated layers all at once,

so that I can hide or delete or modify them all at once.

For example, the sublayers I need to find are all called "circle".

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
Advocate ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

LATEST

Bonjour Jennifer,

Drole de méthode, un calque par tracé, pourquois ne pas utiliser un groupe par reère qui contieidrai à la fois le cercle, le texte et  le trait (nommer les cercles "circle")?

Ce n'est pas mon prblème quant à la question:

On ne peut pas sélectionner un calque par script (en ma connaissance)

donc voià ma solution, pour plus de détails, me consulter par mail.

Suivant la valeur des variables de la zone INIT de script (visible ou remove) le calque "circle".

 

 

 

// JavaScript Document for Illustrator
// INIT ----------
var layername = "circle";
var Visible = false;
var remove = false;
//----------------
    var docRef=activeDocument;
    var pathitems = docRef.pathItems;
        for (var i = pathitems.length-1 ; i >= 0 ; i--) {
          item = pathitems[i];
            if (item.layer.name == layername) {
               if (!Visible) {item.layer.visible = false;}
               if (remove)  item.layer.remove();
            }
        }

 

 

 

René

 

 

 

 

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
New Here ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

found a non-script answer:

https://www.youtube.com/watch?v=AAESBjlo1-o

Select toplevel layer. select release to layers. Shift drag sublayers out the top layer.

(from 'learning illustrator')

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
Advocate ,
May 25, 2020 May 25, 2020

Copy link to clipboard

Copied

Bonjour à tous!
Félicitation JET pour ce script qui est très réfléchi, dans la mesure où les calques se retrouvent tous dans le bon ordre, (1 à 102).
Je n'utiliserez certainement pas ce script mais merci pour ce qu'il m'a apporté, j'ai enfin un peu compris l'utilisation de ElementPlacement.PLACEAFTER.
je ne voyait pas comment l'utiliser. (si vous avez d'autres exemples d'application et aussi avec PLACEBEFORE?).

Si on m'avait demandé de faire ce script, j'aurais utilisé move(currLayer.parent...
mais l'ordre n'est pas toujours bien respecté.

René

PS Je me suis permis de modifier le script pour tout traiter en seule une exécution. testé sur CS6)

 

 

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