Hi guys,
Is there some script to Indesign CS5 that create layers automatically and distribute text, images and objects to them?
Ex: I have one layer with many images and i would like to distribute them to another layers automatically.
Best regards,
JNSaraiva
Below code creates a new layer named "ImageLayer" and move all images to that layer and add "TextLayer" to move text frames.
pictureLayer = app.activeDocument.layers.add ({name: "ImageLayer"});
textLayer= app.activeDocument.layers.add ({name: "TextLayer"});
app.activeDocument.rectangles.everyItem().itemLayer = pictureLayer;
app.activeDocument.textFrames.everyItem().itemLayer = textLayer;
Mac
I'll try to explain more clearly:
1) I have one page with: a main layer with 3 objects in my page: 1 image, 1 text and one object.
2) I would like do select all (command + A)
3) Then go to the script and ask him to do: create more 2 layers (because i already have one), and distribute in each layer created one object.
thank you again,
JNSaraiva
Hi Muppet, i got it, thank you.
But the script doesn't works like i imagine, unfortunately.
The script just transport all objetcs to another layer, it does not create a layer for each object.
I need to separate objects (images, text, objects) in layers, a layer for each of them.
Like this:
Main layer: object1, object2, object3, object4, object5
(than select all and click on script an got this below)
Main layer: object1
Layer 2: object2
Layer 3: object3
Layer 4: object4
Layer 5: object5
Thank you,
JNSaraiva
The fact that you had pasted into Apple Script Editor told me you were on a mac at least… It just helps other users help you, if they know these things. In ID versioning is pretty important too… I don't have 5.5 took a dammed eternity to get to 5… but if you are happy to use ExtendScript then there are many more helpers at hand… by far the most popular language in this forum… Might get the chance to read the thread now…
Hi JNSaraiva
In at a glance of your first requirement looked like you have three specific objects (image, text, otherObjects) and you wanted to move all images on one specific layer and text frames on another specific layer and rest objects to another specific layer. If this what you wanted then my first code will definate full fill it but in your subsequent mail it sounds like you want move every object in your selection on different layer, if this is what you wanted then try my below code:
var mySels = app.selection.length;
if (mySels == 0) {
alert("Select the object and Run the script");
exit(0)
}
else{
while(mySels--){
var objLayer=app.activeDocument.layers.add();
app.selection[mySels].itemLayer = objLayer;
}
}
Mac
Dear Mac, thank you a lot.
Works like a charm in Indesign CS5, you save my day.
Obs: I also did a test in Illustrator CS5 with this script, it worked in part. It creates the layers, but does not send the objects for each one.
It would be perfect if it worked for both programs the same script. ;-)
God bless you.
JNSaraiva
North America
Europe, Middle East and Africa
Asia Pacific