• 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 move to ?

Explorer ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

How to move the layer with the help of script and place it on another layer. is that possible ?

image.png

[moderator cured the message formatting to make it more readable]

TOPICS
Windows

Views

4.6K

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
Community Expert ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

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
Community Expert ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

Oh yes, because of the odd formatting, I did read only half of the message. 😉

 

(I deleted my message, as it was obviously not answering the question)

 

ABAMBO | Hard- and Software Engineer | Photographer

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
Explorer ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

Thanks to Reply.. but I need Place or move  single layer. Place only image layer from selected 2 layer... plz watch video

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
Explorer ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

I want to place the clipping mask layer on another layer.. Only single layer should be moved. is it possible with script48Lkdn3wRM.png

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
Community Expert ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

I'm a bit confused. If the video demonstrates the process you want, then what is the problem?

 

Is the video a "real time" recording, or did you create the video to demonstrate the process that you want scripted (therefore it wasn't a live recording)?

 

It also appears that the image is being resized in the video, rather than only being clipped to a new shape?

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
Explorer ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

Sir thanks for your reply. " I'm a bit confused. If the video demonstrates the process you want, then what is the problem? "= Ye moveing ek software se ho raha hai. .. Kya ye script se move & place ho sakta hai

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
Community Expert ,
Feb 16, 2023 Feb 16, 2023

Copy link to clipboard

Copied

quote
Sir thanks for your reply. "Ye moveing ek software se ho raha hai. .. 
Kya ye script se move & place ho sakta hai"

By @nandu nag

 

 

Translation software from Hindi: "This movement is being done by a software. ..can it be move & place from script"

 

The short answer is yes, in a scripting kind of way!

 

The script would be run once on a selected layer to set the source layer. Then the same/different script could be run a second time to move the previously nominated layer to the newly selected target layer position.

 

Or perhaps if there were uniquely coloured labels on the layers, or unique names, a specific script could be run once as the source and target is explicitly indicated.

 

You would need to write out step by step exactly what you require.

 

For example, when the layer is moved, it must be above the clipping group layer.

 

When the layer is moved, should it be centred or upper left to the new clipping group layer content? Should the image be resized or left at the same size as before? What if the aspect ratio is different, what has to happen?

 

Why use clipping group layers? Why not use layer alpha channels to create selections/masks? Why don't you use a frame instead?

 

It would be best to supply a PSD copy of the template file.

 

The project scope and requirements really need to be made clear so as not to waste any volunteer's time.

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
Explorer ,
Feb 16, 2023 Feb 16, 2023

Copy link to clipboard

Copied

Sir....Two rename layers that place the first rename layer on the second rename layer
Every time the first rename layer is the place.....

The script that I have is not working properly ....plz see this

var idRvrs = charIDToTypeID( "Rvrs" );
var desc131 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref38 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref38.putEnumerated( idLyr, idOrdn, idTrgt );
desc131.putReference( idnull, ref38 );
executeAction( idRvrs, desc131, DialogModes.NO );

var newName =("layer name", "/");

var layers = getSelectedLayers();
for (var i = 0; i < layers.length; i ++){
layers[i].name = newName;
}

 


function getSelectedLayers(){
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.ALL );
var resultLayers=new Array();
for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}
var id8 = charIDToTypeID( "slct" );
var desc5 = new ActionDescriptor();
var id9 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id10 = charIDToTypeID( "HstS" );
var id11 = charIDToTypeID( "Ordn" );
var id12 = charIDToTypeID( "Prvs" );
ref2.putEnumerated( id10, id11, id12 );
desc5.putReference( id9, ref2 );
executeAction( id8, desc5, DialogModes.NO );
return resultLayers;
}


var idslct = charIDToTypeID( "slct" );
var desc133 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref39 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
ref39.putName( idLyr, "/" );
desc133.putReference( idnull, ref39 );
var idMkVs = charIDToTypeID( "MkVs" );
desc133.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list16 = new ActionList();
list16.putInteger( 107 );
desc133.putList( idLyrI, list16 );
executeAction( idslct, desc133, DialogModes.NO );

var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
var idsetd = charIDToTypeID( "setd" );
var desc135 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref40 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref40.putEnumerated( idLyr, idOrdn, idTrgt );
desc135.putReference( idnull, ref40 );
var idT = charIDToTypeID( "T " );
var desc136 = new ActionDescriptor();
var idNm = charIDToTypeID( "Nm " );
desc136.putString( idNm, """/""" );
var idLyr = charIDToTypeID( "Lyr " );
desc135.putObject( idT, idLyr, desc136 );
executeAction( idsetd, desc135, DialogModes.NO ); "

 

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
Community Expert ,
Feb 16, 2023 Feb 16, 2023

Copy link to clipboard

Copied

You should create a new topic for the rename, perhaps a moderator could split the topic? 

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
Explorer ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

thank to reply... 

By grouping the layer which is to be moved and the layer on which it is to be placed, 
by grouping those dona layers and then by identifying the layer name,
I am moving the layer to create an action.. but on grouping, the place of the layer is Position.

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
Explorer ,
Feb 25, 2023 Feb 25, 2023

Copy link to clipboard

Copied

if possible ..one layer from 2 layers (which is the clipping mask layer and its layer name)

can be selected...Select the clipping mask layer only by layer name0001.jpg

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
Explorer ,
Feb 26, 2023 Feb 26, 2023

Copy link to clipboard

Copied

If one of the two layers is identified by the clipping mask layer. , then you can move or place the clipping mask layer...if it is possible0001.jpg

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
Community Expert ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

Please provide a better explanation of the intended process – at the very least a screenshot of »before« and one »after«. 

 

And please try posting in your native or preferred language – maybe the Auto-translation will not work out for that, but it might be worth a try. 

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

Copy link to clipboard

Copied

Sorry to my English...I have created a photoshop action which is working, but whenever I group the selected layer, the layer position is changing.

https://drive.google.com/file/d/1Ut6OrfZcglfArEUn4l7sSKdYMr3fl6ur/view?usp=share_link

  Can the image layer be moved by identifying the clipping mask layer by changing the name of the        select layer?

 

* select layer rename

* clipping mask layer identity

*identity layer move or paste  or place

003.jpg004.jpg

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
Community Expert ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

I don’t have access to the Action and your description does not seem clear to me. 

 

Based on the screenshots I guess this Script might do about half of what you want. 

If one Smart Object and one Shape Layer are selected it duplicates the SO and scales it to fill the bounds of the Shape Layer. 

You can then move that instance of the SO atop the Shape Layer and Clipping Masking it with DOM or AM code. 

// if one smart object and one shape layer are selected scale
// a copy of the smart object to fill the shape layer’s bounds;
// 2023, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
    var selectedLayers = collectSelectedLayersBounds ();
    if (selectedLayers.length == 2) {
        if (selectedLayers[0][3] == 5 && selectedLayers[1][3] == 4) {
            var theSO = selectedLayers[0];
            var theSL = selectedLayers[1];
        };
        if (selectedLayers[0][3] == 4 && selectedLayers[1][3] == 5) {
            var theSO = selectedLayers[1];
            var theSL = selectedLayers[0];
        };
        if (theSO != undefined && theSL != undefined) {
            var soWidth = theSO[2][2]-theSO[2][0];
            var soHeight = theSO[2][3]-theSO[2][1];
            var slWidth = theSL[2][2]-theSL[2][0];
            var slHeight = theSL[2][3]-theSL[2][1];
            var xSO = soWidth/soHeight;
            var xSL = slWidth/slHeight;
            var xOffset = (theSL[2][0] + slWidth/2) - (theSO[2][0] + soWidth/2);
            var yOffset = (theSL[2][1] + slHeight/2) - (theSO[2][1] + soHeight/2);
            if (xSO < xSL) {var theScale = slWidth/soWidth*100}
            else {var theScale = slHeight/soHeight*100};
            duplicateMoveRotateScale(theSO[1], xOffset, yOffset, theScale, theScale, 0);
        }
    }
};
////// collect bounds of selected layers //////
function collectSelectedLayersBounds () {
// set to pixels;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
// get selected layers;
    var selectedLayers = new Array;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var desc = executeActionGet(ref);
    if (desc.getBoolean(stringIDToTypeID("hasBackgroundLayer")) == true) {var theAdd =0}
    else {var theAdd = 1};
    if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
    desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
    var c = desc.count;
    var selectedLayers = new Array();
// run through selected layers;
    for(var i=0;i<c;i++){
    var theIndex = desc.getReference( i ).getIndex()+theAdd;
// get id for solid color layers;
    try {
    var ref = new ActionReference();
    ref.putIndex( charIDToTypeID("Lyr "), theIndex ); 
    var layerDesc = executeActionGet(ref);
    var theName = layerDesc.getString(stringIDToTypeID('name'));
    var theIdentifier = layerDesc.getInteger(stringIDToTypeID ("layerID"));
    var theKind = layerDesc.getInteger(stringIDToTypeID('layerKind'));
    var theBounds = layerDesc.getObjectValue(stringIDToTypeID("bounds"));
    var theseBounds = [theBounds.getUnitDoubleValue(stringIDToTypeID("left")), theBounds.getUnitDoubleValue(stringIDToTypeID("top")), theBounds.getUnitDoubleValue(stringIDToTypeID("right")), theBounds.getUnitDoubleValue(stringIDToTypeID("bottom"))];
    selectedLayers.push([theName, theIdentifier, theseBounds, theKind]);
    } catch (e) {};
    };
// if only one:
    }else{
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var layerDesc = executeActionGet(ref);
    try {
    var theName = layerDesc.getString(stringIDToTypeID('name'));
    var theIdentifier = layerDesc.getInteger(stringIDToTypeID ("layerID"));
    var theKind = layerDesc.getInteger(stringIDToTypeID('layerKind'));
    var theBounds = layerDesc.getObjectValue(stringIDToTypeID("bounds"));
    var theseBounds = [theBounds.getUnitDoubleValue(stringIDToTypeID("left")), theBounds.getUnitDoubleValue(stringIDToTypeID("top")), theBounds.getUnitDoubleValue(stringIDToTypeID("right")), theBounds.getUnitDoubleValue(stringIDToTypeID("bottom"))];
    selectedLayers = [[theName, theIdentifier, theseBounds, theKind]]
    } catch (e) {};
    };
// reset;
    app.preferences.rulerUnits = originalRulerUnits;
    return selectedLayers;
};
////// duplicate layer and move, rotate and scale it //////
function duplicateMoveRotateScale (theLayerID, theX, theY, theScaleX, theScaleY, theRotation) {
    selectLayerByID(theLayerID, false);
    try{
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc10 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref6 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref6.putEnumerated( idLyr, idOrdn, idTrgt );
        desc10.putReference( idnull, ref6 );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc10.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc11 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idHrzn, idPxl, theX );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idVrtc, idPxl, theY );
        var idOfst = charIDToTypeID( "Ofst" );
        desc10.putObject( idOfst, idOfst, desc11 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idWdth, idPrc, theScaleX );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idHght, idPrc, theScaleY );
        var idAngl = charIDToTypeID( "Angl" );
        var idAng = charIDToTypeID( "#Ang" );
        desc10.putUnitDouble( idAngl, idAng, theRotation );
        var idIntr = charIDToTypeID( "Intr" );
        var idIntp = charIDToTypeID( "Intp" );
        var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
        desc10.putEnumerated( idIntr, idIntp, idbicubicAutomatic );
        var idCpy = charIDToTypeID( "Cpy " );
        desc10.putBoolean( idCpy, true );
    executeAction( idTrnf, desc10, DialogModes.NO );
    return app.activeDocument.activeLayer
    } catch (e) {}
    };
// based on code by mike hale, via paul riggott;
function selectLayerByID(id,add){ 
    add = undefined ? add = false:add 
    var ref = new ActionReference();
        ref.putIdentifier(charIDToTypeID("Lyr "), id);
        var desc = new ActionDescriptor();
        desc.putReference(charIDToTypeID("null"), ref );
           if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) ); 
          desc.putBoolean( charIDToTypeID( "MkVs" ), false ); 
       try{
        executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );
    }catch(e){
    alert(e.message); 
    }
    };

Screenshot 2023-03-01 at 08.45.27.pngScreenshot 2023-03-01 at 08.45.44.png

 

I will stop following this thread. 

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
Explorer ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

LATEST

thanku to ...sorry to not my need this script..

  ( Identify clipping mask layer from select 2 layer...if it is possible)

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