Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Moving pasted object to a specified layer

$
0
0

Hi,

I'm working on a script to paste an item into each layer of a document. I can get the pasting and positioning parts to work, but everything remains stacked in one layer. How do I move the pasted object to a specified layer?

 

Here is what I have so far:

 

// --------

var layerCount = app.activeDocument.layers.length;

for (i=0; i < layerCount; i++ ) {

     var targetLayer = app.activeDocument.layers[i];

     app.paste();

     pasted = app.activeDocument.selection;

     pasted[0].position = [(100),(150)];

}

// -------

 

 

I thought "pasted[0].move( targetLayer );" would move the pasted item into that specific layer (targetLayer returns something like "Layer Layer4"), but it only fires up an error message.

 

Any suggestions? I looked through similar postings here but when I tried to apply the solutions to my problem it did not work (partially because I am not a javascripting genius!).


Viewing all articles
Browse latest Browse all 12845

Trending Articles