0 Replies Latest reply on Jun 17, 2013 7:48 AM by K Rams

    Help need for Rectangle creation in particular layer

    K Rams

      Hello everyone,


      I am trying to create following things in active document on existing layers in InDesign

      1. Black stroke color rectangle with page width and Height creation in “Border” Layer
      2. White fill color rectangle with page width and Height creation in “Background” Layer
      3. Lock “paper” Layer
      4. Active Images Layer


      But it’s creating only on Active layer instead of preserve layer, Please help to creation in defined layers and active “Images layer”. I am Lerner to java script i am not able to find out the problem within the script.

       

      Thanks in Advace.

       

       

      var myDocument  = app.activeDocument;

      var rect = myDocument.pages[0].rectangles.add();

      itemLayer:myDocument.layers.item("Border");

      rect.geometricBounds = myDocument.pages[0].bounds;

      rect.strokeColor = myDocument.swatches.item("Black");

      rect.fillColor = myDocument.swatches.item("None");

      rect.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT;

      rect.strokeWeight = 1;

       

      var rect = myDocument.pages[0].rectangles.add();

      itemLayer:myDocument.layers.item("Background");

      rect.geometricBounds = myDocument.pages[0].bounds;

      rect.fillColor = myDocument.swatches.item("Paper");

      rect.strokeColor = myDocument.swatches.item("None");

       

      app.documents.item(0).layers.itemByName("paper").locked ^= 1;

       

      set myLayer = myPub.Layers.Item("Images")

      myInDesign.ActiveDocument.ActiveWindow.ActiveLayer = myLayer