I am trying to write a 'duplicateLayer' function, and I've read all the related posts on these forums. It seems most of the responses have only addressed art inside a layer, and not nested layers/groups. I need to be able to duplicate ALL items in a layer.
I can get the sub-layers, but I can't figure out how to preserve order of the items in the new layer. For example, if my layer looks like this:
layer 1
art 1
art 2
sub layer 1
sub art 1
art 3
I can call layer.pageItems to get my three art objects and duplicate them, and I can call layer.layers to get my one sub layer and duplicate it. But how do I preserve the same order of the art objects and sub layers with respect to each other?
North America
Europe, Middle East and Africa
Asia Pacific