8 Replies Latest reply on Sep 27, 2016 6:48 AM by Tomas Sinkunas

    duplicate() bug?

    Tomas Sinkunas Adobe Community Professional

      Hi. New in Photoshop scripting, but somewhat seasoned in AE scripting.

       

      For instance, I have 2 documents.

      docA has 5 layers (all of them are selected)

      docB has only Background layer.

       

      if I do:

      docA.layers[0].duplicate(docB) -> duplicates all 5 selected layers from docA to docB
      docA.layers[1].duplicate(docB) -> duplicates 1 layer;
      docA.layers[2].duplicate(docB) -> duplicates 1 layer;
      

      etc.

       

      Why

      docA.layers[0].duplicate(docB)
      

      duplicates all layers, instead of first layer in the stack? Is this a bug or am I doing something wrong?

       

       

      If none of layers are selected in docA:

      docA.layers[0].duplicate(docB) -> doesn't do anything
      docA.layers[1].duplicate(docB) -> duplicates 1 layer;
      docA.layers[2].duplicate(docB) -> duplicates 1 layer;
      

       

      What am I missing here?