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

How to Layer Duplicate to active document ?

Explorer ,
May 07, 2023 May 07, 2023

Copy link to clipboard

Copied

The layer is being duplicated from the photoshop javascript given below but it is not happening in the active document any help3W3BSXZJTK.jpg

var sourceDoc = activeDocument;
var sourceLayerName = sourceDoc.activeLayer.name;
var openDocCount = documents.length;
var targetDocIndex = openDocCount - 2;
var targetDocName = documents[targetDocIndex].name;
dupeLayer(sourceLayerName);

function dupeLayer() {
	function s2t(s) {
        return app.stringIDToTypeID(s);
    }
	var descriptor = new ActionDescriptor();
	var list = new ActionList();
	var reference = new ActionReference();
	var reference2 = new ActionReference();
	reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s2t( "targetEnum" ));
	descriptor.putReference( s2t( "null" ), reference );
	reference2.putName( s2t( "document" ), targetDocName );
	descriptor.putReference( s2t( "to" ), reference2 );
	descriptor.putString( s2t( "name" ), sourceLayerName );
	descriptor.putList( s2t( "ID" ), list );
	executeAction( s2t( "duplicate" ), descriptor, DialogModes.NO );
	sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
}
TOPICS
Windows

Views

292

Translate

Translate

Report

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
Explorer ,
May 27, 2023 May 27, 2023

Copy link to clipboard

Copied

LATEST

Whatever document is open after the source document is closed, paste the selected layers in that document by whatever name it may be by any number.
modify this code

Votes

Translate

Translate

Report

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