2 Replies Latest reply on Sep 24, 2013 9:47 PM by Sathya Rani M

    Reg. Working with Duplicate Layer

    Sathya Rani M

      Hi All,


      I am creating the duplicate layer and trying to access its contents but I could not get all the paragraph with contents line by line.


      I have tried with the below code, please have a look into it.


      var myDocument = app.activeDocument;

      var myLayer = myDocument.layers.item(0);

      var lname = myLayer.name;


      var myNewLayer = myLayer.duplicate();

      myDocument.layers.item(lname).visible = false;

      myNewLayer.name = "My Layer";


      var allStories = myDocument.stories;

      for(var i=0; i<allStories.length; i++)


          myStory = myDocument.stories[i];



      for(var j=0; j<myStory.paragraphs.length; j++)


          for(var k=0; k<myStory.paragraphs[j].lines.length; k++)







      From this code, I am getting paragraph length as '1' even though the activeDocument has more number of para's in it.


      Please advice me how to proceed further.


      Thank you for spending time on it.


      ~Sathya Rani M