Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Copy/Move Layerset From One Document To Another Without Flattening

New Here ,
Mar 12, 2009 Mar 12, 2009
Hello,

Does anyone know how to move a layerset from one document to another using JavaScript ExtendScript, but without having to flatten the layers first as I still need to edit them after the move.

Many Thanks,

James
TOPICS
Actions and scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Mar 12, 2009 Mar 12, 2009
This requires that you have the the two documents open the first document open is the one you are copying from with the layer/layers selected.


activeDocument=documents[0];

dupLayers();



function dupLayers() {

var desc15 = new ActionDescriptor();

var ref12 = new ActionReference();

ref12.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc15.putReference( charIDToTypeID('null'), ref12 );

var ref13 = new ActionReference();

ref13.putName( charIDToTypeID('Dcmn'), documents[1].name );

desc15.putReference( charIDToTypeID('T '), ref13 );

desc15.putInteger( charIDToTypeID('Vrsn'), 2 );

executeAction( charIDToTypeID('Dplc'), desc15, DialogModes.NO );

};





Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2009 Mar 12, 2009
Thank you, you absolute star!!!!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 12, 2009 Mar 12, 2009
This can also be done without using Action Manger.

var targetDoc = app.documents.getByName('Untitled-1');// create a reference
var sourceGroup = app.activeDocument.layers.getByName('Group 1');// or use an existing reference
sourceGroup.duplicate ( targetDoc );
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2009 Mar 12, 2009
LATEST
Thanks, that's a bit easier to understand. Perfect!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines