thank to reply.....I want to paste each time the selected layer of the front document just to the back document ..not all open documents
thank to reply.....I want to paste each time the selected layer of the front document just to the back document ..not all open documents
By @nandu nag
It is easy for a human to know which of the multiple open documents is the active document. It is also easy for a script to know which of the multiple open documents is the active document. So all good on the source document!
The target document may not be so easy. A human knows which is the back document, however, a script would need to be programmed to achieve the same result. This would rely on "marking" either the source or the target document or relying on the order that the documents were originally opened. The index order of the source and target documents would need to be logical and consistent.
Edit: The following script has very specific requirements to work as intended, please follow the notes at the head of the script.
#target photoshop
/*
1. Open the target/destination docs first in floating windows
2. Open the source doc last in a floating window
3. Select the layer to duplicate in the source doc and run the script
4. The layer will be copied to the previous doc to the upper left
5. As the duplicate layer command is used, it is assumed that all docs share the same colour mode and colour space
*/
var sourceDoc = activeDocument;
var sourceLayerName = sourceDoc.activeLayer.name;
var openDocCount = documents.length;
var targetDocIndex = openDocCount - 2;
var targetDocName = documents[targetDocIndex].name;
dupeLayer();
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 );
}