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

Separate content from a single layer to multiple layers

Community Beginner ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

I have an InDesign page that has many elements that are all on one layer. Is there an easy way or script I can use to move each individual element to its own layer?

Here is a bit more of an explanation of why I need this:

1. I understand this is not what InDesign is intended for, however I am in this situation and looking for an easy fix.

2. The screen shot below is of a website page design that was created in InDesign. I am showing the 1 and only layer in the file with its contents exposed in the layer panel. What I would like to do is have each one of these elements on a separate layer.

3. The reason I want to do this is because I am then going to use a scrip that will export the page as a layered PSD file based on the layers in InDesign. I have multiple pages I have to do this for and it is time consuming moving each element to an individual layer one by one.

I'm wondering if there is a script available that will take the contents of the layer and move each item out to a separate layer. Or if I have to just keep doing it manually.

Screen Shot 2019-08-19 at 3.26.02 PM.png

TOPICS
Scripting

Views

3.2K

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

Explorer , Aug 19, 2019 Aug 19, 2019

I've tried the script on only 3 empty TextFrames regardles of stacking order 😞

It was too quick !!

Ofcourse stacking order is very important !!!

In my environment there is ONE page only and ONE source Layer only.

In such conditions script written below works.

var fl = app.activeDocument.layers.firstItem();

var items = fl.pageItems.everyItem().getElements();

var i = items.length;

while ( i-- ) {

    app.activeDocument.layers.add( { name : 'Layer_'+i } )

    items.itemLayer = app.activeDocument.layers.item

...

Votes

Translate

Translate
Explorer ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Hello,

try to select all the items on Layer 1

then run this:

var sel = app.selection

var i = sel.length;

while ( i-- ) {

    app.activeDocument.layers.add( { name : 'Layer_'+i } )

    sel.itemLayer = app.activeDocument.layers.itemByName( 'Layer_'+i );

    }

regards

a.

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 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Hi platm72,

Thanks so much for your response. I am a novice when it comes to scripts. I know where to save script files on my system to then run them but I don't know where to put this code? Can you please tell me where I copy and paste the code to make the script work?

Thank you

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
Explorer ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Sure 🙂

Open ExtendScript Toolkit, then paste the code and save the script – best way in Scripts Folder inside Main Indesign Folder.

The script will run if at least on item on page will be selected.

Write me please if you need some modifications or improvements of this simple script 🙂

regards

a

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 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Thank you!!!

That worked, howeverand I might be pressing my luck here—is there any way to have it create the layers in the same order as the were originally stacked?

Below is

1. Screen shot of the page before running the script

2. Screen shot after running the script. It successfully created the layers, however out of order so items are burried

3. In case it is helpful, a screen shot of what the layers list looks like after running the script.

Thanks!

Screen Shot 2019-08-19 at 5.46.02 PM.png

Screen Shot 2019-08-19 at 5.45.40 PM.png

Screen Shot 2019-08-19 at 5.47.36 PM.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
Explorer ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

I've tried the script on only 3 empty TextFrames regardles of stacking order 😞

It was too quick !!

Ofcourse stacking order is very important !!!

In my environment there is ONE page only and ONE source Layer only.

In such conditions script written below works.

var fl = app.activeDocument.layers.firstItem();

var items = fl.pageItems.everyItem().getElements();

var i = items.length;

while ( i-- ) {

    app.activeDocument.layers.add( { name : 'Layer_'+i } )

    items.itemLayer = app.activeDocument.layers.itemByName( 'Layer_'+i );

    }

fl.remove();

Now you don't need to select enything. Just open document witch ONE page and ONE layer and run the script. Stacking order should be saved.

regards

a.

A.pngB.png

C.png

D.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 Beginner ,
Aug 20, 2019 Aug 20, 2019

Copy link to clipboard

Copied

This is AMAZING! I cannot thank you enough!! You saved me so much time.

Very much appreciated.

Thanks!

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
Explorer ,
Oct 14, 2021 Oct 14, 2021

Copy link to clipboard

Copied

Hi.
Does the script work in the latest versions of inDesign 2020 and 2021? I tested both. All new layers are empty. This script would help me a lot. I need help.

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 ,
Oct 14, 2021 Oct 14, 2021

Copy link to clipboard

Copied

Just try it out.

If it will not work report the error message(s) you are seeing.

Do your tests on a duplicate of your document.

 

Regards,
Uwe Laubender

( ACP )

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
Explorer ,
Oct 14, 2021 Oct 14, 2021

Copy link to clipboard

Copied

I tested, no error message. Code doesn't work in inDesign 2021 (16.1). I'm sending a screen shot.

Regards,

Kamil

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 ,
Oct 15, 2021 Oct 15, 2021

Copy link to clipboard

Copied

Ok. That means, basically the script is working, but it does not do what you expected.

Means: it's up to platm72 to see into the issue. Contact platm72, you can send a private message, just click the avatar and work the button "Send Message"…

 

And you can make your document available as well for testing.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Sep 12, 2019 Sep 12, 2019

Copy link to clipboard

Copied

Hi @platm72,

I hope this reply goes through in the new forum.

 

The stacking order of elements has to be seen spread by spread ( InDesign CS5 version 7 and above! ).

And the array that maps this stacking order is spread.allPageItems.

( At least when no multistate objects with two or more states or buttons with two or three states are involved, then it would be more complicated. )

 

So you could build a reliable stacking order looping the allPageItems array of a spread.

But note the following: If you want to move page items where the parent is the spread and not the ones that are anchored or part of a nested structure like groups or within a table's graphic cells or inserted otherwise in graphic frames you have to test for parent.constructor.name == "Spread". All anchored or nested items will move along with the one where the parent is the spread.

 

If you want to free items from their nested status in the right stacking order you have to either unanchor them ( all page items with parent.constructor.name == "Character" or first anchor them to temp text frames on the spread and then release them on the spread ( with all otherwise nested items test for: parent constructor.name != "Spread" && parent constructor.name != "Character" ).

 

Regards,
Uwe

 

FWIW: This my first attempt for a reply on the new forum after its gone "live".

 

Regards,

Uwe

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 ,
Dec 08, 2024 Dec 08, 2024

Copy link to clipboard

Copied

Hi Guys, 

using Indesign 2025 and have my design done on 1 layer, I now need to separate the 1 layer into individual layers on the file. Is there an easy way to do this?

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
Adobe Employee ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

Hi @Nilesh1234567890,

 

Thanks for reaching out! If you're using InDesign 2025 and want to separate all elements from a single layer into individual layers, please try below: 

 

Separate Elements into Individual Layers:

1. Open the Layers Panel

 - Go to Window > Layers to open the Layers panel.

2. Select All Elements on the Layer

 - Click the small circle next to the layer name in the Layers panel to select all objects on that layer.

3. Create New Layers

 - In the Layers panel, click the "New Layer" icon (at the bottom of the panel) to create as many layers as the number of elements you want to separate.

4. Move Elements to New Layers

 - Select an object on the page.
 - In the Layers panel, click and drag the small colored square (to the right of the layer name) to the desired new layer.
 - Repeat this step for each element, moving them to individual layers.

5. Name Your Layers (Optional)

 - Double-click the layer name in the Layers panel to rename each layer for better organization.

 

Note: If you have many elements and need to speed up the process, you can:

  • Group elements that belong together before moving them to a new layer.
  • Use shortcuts (Ctrl/Cmd + Alt + Shift + [ ]) to quickly cycle through selections and move items.

While this method is more manual, it works well if you want control over where each element goes. Let me know if you have further questions or need additional guidance! 

 

Best,
Abhishek

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 ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

Thanks Abhishek
I was trying to avoid this manual process. Wondering if there’s an easier way to do this in Indesign?

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
Adobe Employee ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

Hi @Nilesh1234567890,  

 

Thanks for the follow-up! Unfortunately, InDesign doesn't currently have a one-click feature to automatically separate all elements on a layer into individual layers. The manual method is the most reliable way to achieve this level of control.  

Let me know if you have any further queries, would be happy to assist. 

 

Best,  
Abhishek

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 ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

LATEST
quote
Thanks AbhishekI was trying to avoid this manual process. Wondering if there’s an easier way to do this in Indesign?
By @Nilesh1234567890

 

There is - although not free and PC only - my ID-Tasker tool - but probably overkill for one time job - unless you are willing to send me your file and describe how you want your objects to be split into separate layers and I'll do it for you for free.

 

In my tool - you can load complete structure of your document - with 800+ properties and then sort & filter by those properties and then move to different layers.

 

So, for example, you can move Rectangles to a specific layer - or only Rectangles that have:

- image inside from a specific folder,

- and / or specific string in the path / name,

- and / or with a specific stroke's color / thickness, 

- and / or specific location on left / or right pages - in a specific range of pages, 

- etc. etc. etc. 

 

If you want to split objects by text contents - you have access to 400+ text properties, so, you can split by: 

- applied language, 

- specific word / phrase, 

- formatting, 

- number of text lines, 

- applied color, 

- etc. 

 

Then, after you set your requirements, you can save it as a Task and run next day / week / month, or process server full of INDD files overnight. 

 

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