Skip navigation
Currently Being Moderated

Indesign CS5 | Create layers and Distribute automatically. [script]

Aug 18, 2011 9:17 AM

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

 
Replies
  • Currently Being Moderated
    Aug 18, 2011 9:45 AM   in reply to 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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 18, 2011 10:18 AM   in reply to JNSaraiva

     

    Hope my perception would be wrong, I don’t think you run this script fragment otherwise I am not understanding what your requirement is sorry…

     

    Mac

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 18, 2011 1:55 PM   in reply to JNSaraiva

    That's what the script above will do. Try it.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2011 6:15 AM   in reply to JNSaraiva

    Thats because the syntax is Adobe's ExtendScript and not AppleScript… C&P into ExtendScript Toolkit… This editing/debugging app can be found in your utilities folder…

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2011 8:51 AM   in reply to JNSaraiva

    I didn't get so far as your script request… just noticed the problem… It does save some confusion/presumption if you state your OS and preferred scripting language if you have one…

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2011 11:03 AM   in reply to 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…

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2011 11:03 AM   in reply to JNSaraiva

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2011 7:27 AM   in reply to JNSaraiva

    Illustrator does not have an 'itemLayer' property… In ID this property is r/w so objects can be relocated by changing this… In AI you would need to move to each new layer as the page items 'layer' property is r/o…

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 2, 2011 9:15 AM   in reply to JNSaraiva

    When I tried this script, it errors and complains that it cannot move locked objects. I have some layers locked. No

    objects are locked as far as I know. How can the script be adjusted to ignore locked layers?

     

    Best to you,

     

    Mike Witherell in Maryland

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points