Copy to Destination

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, DavideBarranca, Paul MR

Posts: 2
Joined: Mon Dec 12, 2016 12:55 pm

Copy to Destination

Postby Ronan » Mon Dec 12, 2016 1:56 pm

Hello All,
I am beginner in java script

I was wondering if it's possible to create a script that copy current layer to selected group or layer (near)
script should work like copy/paste ( for example i assign shortcut ctrl+alt+c for copy and ctrl+alt+v for paste)

Ps usually make copy (Layer via Copy) of layer above of current selected layer, its be nice if Ps make copy of layer to selected destination

here is good one ( Mike Hale version, thanks to Mike)
Send to group
Script its good when document have up to 100 layers, but
for documents who has more than hundred of layers (in some case more than 1000+)
is very irritate to scroll down/up through list(its too big ) every time

I need faster way,

1 Select the layer that I need to copy and press ctrl+alt+c

2. When i select in Layer Panel destination group or layer with Mouse(if is possible, i think should be faster with Mouse)
if i select on Canvas other layer(Auto-Select layer in the Move tool) which is situated in the destination

3. I press Ctrl+Alt+V script should copy layer

Sorry for my English.

Posts: 2
Joined: Mon Dec 12, 2016 12:55 pm

Re: Copy to Destination

Postby Ronan » Tue Feb 07, 2017 2:04 pm

Thanks for link
You are the author of this script?

Unfortunately Copio script doesn't work as I expected, he just make a copy of layer in top of layer panels
The script is made up of 2 scripts
Copio - Copy.jsxbin - memorize selected layer
Copio - Paste.jsxbin - "paste" layer to top of layers, but not in destination group

I think the author has done a good job in the first part - memorize selected layer
second script Copio - Paste.jsxbin should be modified

It's possible to do the same in one script :

Code: Select all

#target photoshop

// layer via copy;
var id14 = charIDToTypeID( "CpTL" ); 
executeAction( id14, undefined, DialogModes.NO );

// move layer to top
    var doc=app.activeDocument; 
    var moveLayer = doc.activeLayer;   
    var targetLayer = doc.layers[0];//say topmost layer;   
    var laySB=doc.activeLayer.bounds;[[laySB[0],laySB[1]],[laySB[2],laySB[1]],[laySB[2],laySB[3]],[laySB[0],laySB[3]]], SelectionType.REPLACE, 0, false); 
    function align(method) {   
      var desc = new ActionDescriptor();   
      var ref = new ActionReference();   
      ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );   
      desc.putReference( charIDToTypeID( "null" ), ref );   
      desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );   
      executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );   

In my opinion this is a very important function that will be widely used, it would be better if it would be done
But I do not know how I could do that
The easy part is to make copy of layer,
Second part move or 'paste' to destination probably not so easy to do

Does anyone have any idea how to do?

Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 1 guest