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

Selecting multiple objects by colour and move to a new layer

New Here ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

I have a InDesign project with LOTS of red and blue circles.  I would like to separate the circles into two layers.  Is it possible to select by colour and move all objects to a new layer?

Thanks

Views

728

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
Guru ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

the option to select by same fill exists in illustrator, not indesign. why not paste all of the art to illustrator, and do a select by fill , get what you need  and bring thing in back to indesign that way?

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 ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

Hi,

Use a script!

Best,

Michel from FRIdNGE

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
Guru ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

and the script is?

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 ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

Basically, something like this:

var myDoc = app.activeDocument,

myColor1 = "red",

myColor2 = "blue",

myLayer1 = "red_layer",

myLayer2 = "blue_layer",

myPageItems = myDoc.pageItems.everyItem().getElements(),

I = myPageItems.length,  i;

for ( i = 0; i < I; i++ ) {  

    if ( myPageItems.fillColor.name == myColor1 ) myPageItems.itemLayer = myLayer1;

    if ( myPageItems.fillColor.name == myColor2 ) myPageItems.itemLayer = myLayer2;

}

Best,

Michel, from FRIdNGE

[I let you define "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
Community Expert ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

[I let you define "circle"!]

Hi Michel,

we could discuss this as well 🙂

At first glance this seems to be easy, but one could imagine that also a textFrame could count as a circle if someone clicked inside a circle-like graphic frame with the Text tool. Just one obstacle one could face 🙂

Here a series of screenshots where 6 circular shapes are presented.

InDesign claims that only 2 are actual circles where indeed most of us will identify 4 or perhaps 5 out of 6 as circles.

From my German InDesign:

Kreis > Circle

Pfad > Path

Polygon > Polygon

Ellipse > Oval

Textrahmen > Text Frame

Let's begin, obviously the first object selected on the page below actually is a circle. It has all circle-like properties.
Width is the same as height and the shape is overall rounded. And indeed, my German InDesign claims this as "Kreis" which means "Circle":

WhatExactlyIsA-Circle-1.png

Next one selected. InDesign claims this as "Pfad", a Path object:

WhatExactlyIsA-Circle-2.png

Why is that? If I align the first selected object and this one to each other you'll see no difference.

The reason: There is a 5th path point on the shape:

WhatExactlyIsA-Circle-3.png

Next one is a Polygon. Why?

WhatExactlyIsA-Circle-4.png

Because it's a regular polygon with 100 path points:

WhatExactlyIsA-Circle-5.png

Let's see into the next shape. Here InDesign says "Ellipse", maybe "Oval" or "Ellipsis" in an English locale version:

WhatExactlyIsA-Circle-6.png


Why? There is no extra path point, it is no polygon with perhaps even more path points. No. It is simply scaled. Yes. Look at the scaling factors of the percentage fields: 100 % in x-direction and 83.333333 % in y-direction. So it once was an oval and now seems to be a circle. Width and height is exactly the same!

On to the next shape. Now this one I'd say—99.99999 percent of you—wouldn't call this a circle. But InDesign stupidly claims that this is a circle:

WhatExactlyIsA-Circle-7.png

Why? Because it is a circle! Only a skewed circle, a transformed one! Look at the Transformation Panel.

And the last one in that row—I think, everyone will agree—is a circle, but actually it is a text frame, a "Textrahmen" in German.

With text frames InDesign does not discern one shape from another it's simply a text frame. That it is shaped like a circle is not so interesting for the Layers Panel:

WhatExactlyIsA-Circle-8.png

Note: The term "Circle" does not exist in the scripting languages for InDesign. There is only Oval.

Question: Which of the shapes above will ExtendScript identify as ovals?

Hi pamelab97412894 ,

how would you define a "circle" on your page?


Or better asked:

Are there other oval-like objects that should not be moved to a distinct layer?

If not, the task could be easy and Michel's script is not far from perfection.

If yes, scripting this task is getting very interesting…

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
Mentor ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Thank you, Uwe!

Very interesting class

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Hi Uwe,

Interesting explanations! …

I add one more issue:

It's not because the user duplicates a "true" circle that InDesign will give him another "true" circle!

To be meditated!

Best,

Michel, from FRIdNGE

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

LATEST

Hi Michel,

there are other examples as well:

1. Select a object that is obviously a <Circle>.
2. Open the path of the selected object.

The layers panel is still showing it as a <Circle>.

Deselect and reselect it: Now the layers panel is showing it as a <Path>.

However, scripting still will identify it as [object Oval] .

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
Community Expert ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

You might get some help in the scripting forum.

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