Skip to main content
Known Participant
August 5, 2022
Répondu

How do I automatically copy the dimensions and position of one layer to another

I have to do the same manual process everytime and I wanna know if there's a way to make it automatic to release me from my suffering!

I have a text layer and I wanna make a shape layer have the same dimensions and position in the canvas, normally I do this by manually resizing and positioning the Shape layer, but I realized if press Ctrl + T, I have access to the size of the layer and it's position in the canvas, if I manually copy and paste these values from the Text Layer to the Shape Layer it does what I need, but I waste time doing that, so I wanna know if there's a way to do it automatically, a hidden feature or a script.

The text is always different, so I can't just use the same values everytime. See the images for an example.

Meilleure réponse par Stephen Marsh

I will likely modify/update the following two scripts, however for now I hope that they serve.

 

EDIT – 7th August 2022, Scripts updated to 1.3 version:

 

Step 1 of 2:

 

/*
Resize Layer from Source - Script 1 of 2.jsx
Stephen Marsh, v1.3 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on the source layer to copy the layer bounds info to the desktop preference file
*/

#target photoshop

// Store the original ruler units and set to px
var savedRuler = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

// Set the layer dimension variables
var layerWidth = (activeDocument.activeLayer.bounds[2] - activeDocument.activeLayer.bounds[0]);
var layerHeight = (activeDocument.activeLayer.bounds[3] - activeDocument.activeLayer.bounds[1]);
var layerLeft = activeDocument.activeLayer.bounds[0];
var layerRight = activeDocument.activeLayer.bounds[2];
var layerTop = activeDocument.activeLayer.bounds[1];
var layerBottom = activeDocument.activeLayer.bounds[3];

// Log text file platform specific LF options
var os = $.os.toLowerCase().indexOf("mac") >= 0 ? "mac" : "windows";
if (os === "mac") {
    prefFileOutLF = "Unix"; // Legacy = "Macintosh"
} else {
    prefFileOutLF = "Windows";
}

// Create the preference file
var prefFileOut = new File('~/Desktop/_Resize_Layer_Preference_File.txt');
var dateTime = new Date().toLocaleString();
if (prefFileOut.exists)
    prefFileOut.remove();
    prefFileOut.open("w");
    prefFileOut.encoding = "UTF-8";
    prefFileOut.lineFeed = prefFileOutLF;
    prefFileOut.writeln(dateTime + ", " + "Source Doc: " + activeDocument.name + ", " + "Source Layer: " + activeDocument.activeLayer.name);
    prefFileOut.writeln(layerWidth.value);
    prefFileOut.writeln(layerHeight.value);
    prefFileOut.writeln(layerLeft.value);
    prefFileOut.writeln(layerRight.value);
    prefFileOut.writeln(layerTop.value);
    prefFileOut.writeln(layerBottom.value);
    prefFileOut.close();

// Restore the original ruler units
app.preferences.rulerUnits = savedRuler;

// End of script
alert("Source layer coordinates copied!");

 

Step 2 of 2:

 

/*
Resize Layer from Source - Script 2 of 2.jsx
Stephen Marsh, v1.3 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on multiple target layers to resize using the source layer size from the desktop preference file
*/

#target photoshop

function main() {

    // Extra padding value in px: 0 or 100 etc.
    var pxPadding = 0;

    var prefFileIn = File('~/Desktop/_Resize_Layer_Preference_File.txt');

    // Store the original ruler units and set to px
    var savedRuler = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;

    if (File(prefFileIn).exists && File(prefFileIn).length > 0) {
        try {
            // Read the preference file from the user's desktop
            prefFileIn.open('r');
            // Read the 1st line from the log file, a means to an end...
            var logInfo = prefFileIn.readln(1);
            // Read the remaining values and convert the string to a number/integer
            var prefFileWidthValue = Math.floor(prefFileIn.readln(2));
            var prefFileHeightValue = Math.floor(prefFileIn.readln(3));
            var prefFileLeftValue = Math.floor(prefFileIn.readln(4));
            var prefFileRightValue = Math.floor(prefFileIn.readln(5));
            var prefFileTopValue = Math.floor(prefFileIn.readln(6));
            var prefFileBottomValue = Math.floor(prefFileIn.readln(7));
            prefFileIn.close();
        } catch (error) {
            alert("An unexpected error occurred when reading the preference file!")
        }

        processSelectedLayers();

        // End of script
        app.refresh();
        prefFileIn.remove();
        app.beep();
        //alert("Script completed!");

        // Restore the original ruler units
        app.preferences.rulerUnits = savedRuler;


        // Functions

        function processSelectedLayers() {
            var s2t = stringIDToTypeID;
            (r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
            r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
            var lrs = executeActionGet(r).getList(p),
                sel = new ActionReference();

            for (var i = 0; i < lrs.count; i++) {
                sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
                (r = new ActionReference).putIdentifier(s2t('layer'), p);
                (d = new ActionDescriptor()).putReference(s2t("target"), r);
                executeAction(s2t('select'), d, DialogModes.NO);

                // Call the resize layer function
                resizeLayerFromPrefFile();
            }
        }

        function resizeLayerFromPrefFile() {

            // Convert the selected layer to an embedded Smart Object
            // A hack to work in px rather than converting to % for use with .resize()
            executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
            // Edit the smart object
            app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
            // Resize the smart object using px
            activeDocument.resizeImage(prefFileWidthValue + pxPadding, prefFileHeightValue + pxPadding, activeDocument.resolution, ResampleMethod.BICUBIC);
            // Close saving changes
            activeDocument.close(SaveOptions.SAVECHANGES);
            // Convert the smart object back to a layer (doesn't work in older versions)
            app.runMenuItem(stringIDToTypeID('placedLayerConvertToLayers'));
            // Remove the layer group
            removeGroup(false);

            // Align
            align2SelectAll('AdLf');
            align2SelectAll('AdTp');
            // Reposition the resized layer
            app.activeDocument.activeLayer.translate(prefFileLeftValue, prefFileTopValue);
            // Adjust the position after padding
            if (pxPadding > 0) {
                var positionValue = pxPadding / 2;
                activeDocument.activeLayer.translate(-positionValue, -positionValue);
            }
        }

        function align2SelectAll(method) {
            /* 
            AdLf = Align Left
            AdRg = Align Right
            AdCH = Align Centre Horizontal
            AdTp = Align Top
            AdBt = Align Bottom
            AdCV = Align Centre Vertical
            */
            app.activeDocument.selection.selectAll();
            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));
            try {
                executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
            } catch (e) {}
            app.activeDocument.selection.deselect();
        }

        function removeGroup(deleteContained) {
            try {
                var s2t = function (s) {
                    return app.stringIDToTypeID(s);
                };
                var descriptor = new ActionDescriptor();
                var reference = new ActionReference();
                reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
                descriptor.putReference(s2t("null"), reference);
                descriptor.putBoolean(s2t("deleteContained"), deleteContained);
                executeAction(s2t("delete"), descriptor, DialogModes.NO);
            } catch (e) {}
        }

    } else {
        app.beep();
        alert('There is no valid file named "_Resize_Layer_Preference_File.txt" on the desktop!');
    }
}

activeDocument.suspendHistory("Resize selected layers script", "main()");

 

3 commentaires

Stephen Marsh
Community Expert
Community Expert
August 7, 2022

@HeyoThere – I have updated the previous script to remove the temporary layer group created by Photoshop when converting the smart object back to layers.

 

I have written a few "two-part" scripts which require variables to be written to a preference file to provide permanence (as after the first script is run the variables cease to exist and are no longer available to the second script).

 

For a while now I have wanted to explore using a Photoshop "Environment Variable" to store the temporary variables from the first script run, without having to write them to a text file. Here it is!

 

Step 1 of 2:

 

/*
Resize Layer from Source - Script 1 of 2.jsx
Stephen Marsh, v2.0 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on the source layer to copy the layer bounds info to the current Photoshop session environment variable
*/

#target photoshop

// Store the original ruler units and set to px
var savedRuler = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

// Set the layer dimension variables
var layerWidth = (activeDocument.activeLayer.bounds[2] - activeDocument.activeLayer.bounds[0]);
var layerHeight = (activeDocument.activeLayer.bounds[3] - activeDocument.activeLayer.bounds[1]);
var layerLeft = activeDocument.activeLayer.bounds[0];
var layerRight = activeDocument.activeLayer.bounds[2];
var layerTop = activeDocument.activeLayer.bounds[1];
var layerBottom = activeDocument.activeLayer.bounds[3];

// Create the "Environment Variables"
$.setenv(resizeLayer1 = layerWidth.value);
$.setenv(resizeLayer2 = layerHeight.value);
$.setenv(resizeLayer3 = layerLeft.value);
$.setenv(resizeLayer4 = layerRight.value);
$.setenv(resizeLayer5 = layerTop.value);
$.setenv(resizeLayer6 = layerBottom.value);

// Restore the original ruler units
app.preferences.rulerUnits = savedRuler;

// End of script
alert("Source layer coordinates copied!");

 

Step 2 of 2:

 

/*
Resize Layer from Source - Script 2 of 2.jsx
Stephen Marsh, v2.0 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on multiple target layers to resize using the source layer size from the current Photoshop session environment variable
*/

#target photoshop

function main() {

    // Extra padding value in px: 0 or 100 etc.
    var pxPadding = 0;

    // Store the original ruler units and set to px
    var savedRuler = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;

    // Convert the string to a number/integer
    var prefFileWidthValue = Math.floor(resizeLayer1);
    var prefFileHeightValue = Math.floor(resizeLayer2);
    var prefFileLeftValue = Math.floor(resizeLayer3);
    var prefFileRightValue = Math.floor(resizeLayer4);
    var prefFileTopValue = Math.floor(resizeLayer5);
    var prefFileBottomValue = Math.floor(resizeLayer6);

    processSelectedLayers();

    // Restore the original ruler units
    app.preferences.rulerUnits = savedRuler;

    // End of script
    app.refresh();
    app.beep();
    //alert("Script completed!");


    // Functions

    function processSelectedLayers() {
        var s2t = stringIDToTypeID;
        (r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
        r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
        var lrs = executeActionGet(r).getList(p),
            sel = new ActionReference();

        for (var i = 0; i < lrs.count; i++) {
            sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
            (r = new ActionReference).putIdentifier(s2t('layer'), p);
            (d = new ActionDescriptor()).putReference(s2t("target"), r);
            executeAction(s2t('select'), d, DialogModes.NO);

            // Call the resize layer function
            resizeLayerFromPrefFile();
        }
    }

    function resizeLayerFromPrefFile() {

        // Convert the selected layer to an embedded Smart Object
        // A hack to work in px rather than converting to % for use with .resize()
        executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
        // Edit the smart object
        app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
        // Resize the smart object using px
        activeDocument.resizeImage(prefFileWidthValue + pxPadding, prefFileHeightValue + pxPadding, activeDocument.resolution, ResampleMethod.BICUBIC);
        // Close saving changes
        activeDocument.close(SaveOptions.SAVECHANGES);
        // Convert the smart object back to a layer (doesn't work in older versions)
        app.runMenuItem(stringIDToTypeID('placedLayerConvertToLayers'));
        // Remove the parent group
        removeGroup(false);
        // Align
        align2SelectAll('AdLf');
        align2SelectAll('AdTp');
        // Reposition the resized layer
        app.activeDocument.activeLayer.translate(prefFileLeftValue, prefFileTopValue);
        // Adjust the position after padding
        if (pxPadding > 0) {
            var positionValue = pxPadding / 2;
            activeDocument.activeLayer.translate(-positionValue, -positionValue);
        }
    }

    function align2SelectAll(method) {
        /* 
        AdLf = Align Left
        AdRg = Align Right
        AdCH = Align Centre Horizontal
        AdTp = Align Top
        AdBt = Align Bottom
        AdCV = Align Centre Vertical
        */
        app.activeDocument.selection.selectAll();
        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));
        try {
            executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
        } catch (e) {}
        app.activeDocument.selection.deselect();
    }

    function removeGroup(deleteContained) {
        var s2t = function (s) {
            return app.stringIDToTypeID(s);
        };
        var descriptor = new ActionDescriptor();
        var reference = new ActionReference();
        reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
        descriptor.putReference(s2t("null"), reference);
        descriptor.putBoolean(s2t("deleteContained"), deleteContained);
        executeAction(s2t("delete"), descriptor, DialogModes.NO);
    }
}

activeDocument.suspendHistory("Resize selected layers script", "main()");

 

 

Zesty_wanderlust15A7
Known Participant
August 7, 2022

app.beep();

> Wow! 🙂  I had been doing Beeps for a while by calling an outside method from within an action. After a while, this gave gave me the worst PC trouble ever (even the BIOS crashed, but repaired itself), so I stopped that and miss it every day.

I'm gonna risk using this one though — thanks!

I feel a beep is very useful at the end of a Save action/script, to be somewhat sure it actually executed and you didn't remain stuck in an active field (more of a problem on a PC, I guess).

Stephen Marsh
Community Expert
Community Expert
August 7, 2022

I find them less intrusive than an alert,  sometimes I use one or the other or both as an end of script notification.

Stephen Marsh
Community Expert
Community Expert
August 6, 2022

I will likely modify/update the following two scripts, however for now I hope that they serve.

 

EDIT – 7th August 2022, Scripts updated to 1.3 version:

 

Step 1 of 2:

 

/*
Resize Layer from Source - Script 1 of 2.jsx
Stephen Marsh, v1.3 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on the source layer to copy the layer bounds info to the desktop preference file
*/

#target photoshop

// Store the original ruler units and set to px
var savedRuler = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

// Set the layer dimension variables
var layerWidth = (activeDocument.activeLayer.bounds[2] - activeDocument.activeLayer.bounds[0]);
var layerHeight = (activeDocument.activeLayer.bounds[3] - activeDocument.activeLayer.bounds[1]);
var layerLeft = activeDocument.activeLayer.bounds[0];
var layerRight = activeDocument.activeLayer.bounds[2];
var layerTop = activeDocument.activeLayer.bounds[1];
var layerBottom = activeDocument.activeLayer.bounds[3];

// Log text file platform specific LF options
var os = $.os.toLowerCase().indexOf("mac") >= 0 ? "mac" : "windows";
if (os === "mac") {
    prefFileOutLF = "Unix"; // Legacy = "Macintosh"
} else {
    prefFileOutLF = "Windows";
}

// Create the preference file
var prefFileOut = new File('~/Desktop/_Resize_Layer_Preference_File.txt');
var dateTime = new Date().toLocaleString();
if (prefFileOut.exists)
    prefFileOut.remove();
    prefFileOut.open("w");
    prefFileOut.encoding = "UTF-8";
    prefFileOut.lineFeed = prefFileOutLF;
    prefFileOut.writeln(dateTime + ", " + "Source Doc: " + activeDocument.name + ", " + "Source Layer: " + activeDocument.activeLayer.name);
    prefFileOut.writeln(layerWidth.value);
    prefFileOut.writeln(layerHeight.value);
    prefFileOut.writeln(layerLeft.value);
    prefFileOut.writeln(layerRight.value);
    prefFileOut.writeln(layerTop.value);
    prefFileOut.writeln(layerBottom.value);
    prefFileOut.close();

// Restore the original ruler units
app.preferences.rulerUnits = savedRuler;

// End of script
alert("Source layer coordinates copied!");

 

Step 2 of 2:

 

/*
Resize Layer from Source - Script 2 of 2.jsx
Stephen Marsh, v1.3 - 7th August 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-automatically-copy-the-dimensions-and-position-of-one-layer-to-another/td-p/13117557
NOTES:
Run this script on multiple target layers to resize using the source layer size from the desktop preference file
*/

#target photoshop

function main() {

    // Extra padding value in px: 0 or 100 etc.
    var pxPadding = 0;

    var prefFileIn = File('~/Desktop/_Resize_Layer_Preference_File.txt');

    // Store the original ruler units and set to px
    var savedRuler = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;

    if (File(prefFileIn).exists && File(prefFileIn).length > 0) {
        try {
            // Read the preference file from the user's desktop
            prefFileIn.open('r');
            // Read the 1st line from the log file, a means to an end...
            var logInfo = prefFileIn.readln(1);
            // Read the remaining values and convert the string to a number/integer
            var prefFileWidthValue = Math.floor(prefFileIn.readln(2));
            var prefFileHeightValue = Math.floor(prefFileIn.readln(3));
            var prefFileLeftValue = Math.floor(prefFileIn.readln(4));
            var prefFileRightValue = Math.floor(prefFileIn.readln(5));
            var prefFileTopValue = Math.floor(prefFileIn.readln(6));
            var prefFileBottomValue = Math.floor(prefFileIn.readln(7));
            prefFileIn.close();
        } catch (error) {
            alert("An unexpected error occurred when reading the preference file!")
        }

        processSelectedLayers();

        // End of script
        app.refresh();
        prefFileIn.remove();
        app.beep();
        //alert("Script completed!");

        // Restore the original ruler units
        app.preferences.rulerUnits = savedRuler;


        // Functions

        function processSelectedLayers() {
            var s2t = stringIDToTypeID;
            (r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
            r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
            var lrs = executeActionGet(r).getList(p),
                sel = new ActionReference();

            for (var i = 0; i < lrs.count; i++) {
                sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
                (r = new ActionReference).putIdentifier(s2t('layer'), p);
                (d = new ActionDescriptor()).putReference(s2t("target"), r);
                executeAction(s2t('select'), d, DialogModes.NO);

                // Call the resize layer function
                resizeLayerFromPrefFile();
            }
        }

        function resizeLayerFromPrefFile() {

            // Convert the selected layer to an embedded Smart Object
            // A hack to work in px rather than converting to % for use with .resize()
            executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
            // Edit the smart object
            app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
            // Resize the smart object using px
            activeDocument.resizeImage(prefFileWidthValue + pxPadding, prefFileHeightValue + pxPadding, activeDocument.resolution, ResampleMethod.BICUBIC);
            // Close saving changes
            activeDocument.close(SaveOptions.SAVECHANGES);
            // Convert the smart object back to a layer (doesn't work in older versions)
            app.runMenuItem(stringIDToTypeID('placedLayerConvertToLayers'));
            // Remove the layer group
            removeGroup(false);

            // Align
            align2SelectAll('AdLf');
            align2SelectAll('AdTp');
            // Reposition the resized layer
            app.activeDocument.activeLayer.translate(prefFileLeftValue, prefFileTopValue);
            // Adjust the position after padding
            if (pxPadding > 0) {
                var positionValue = pxPadding / 2;
                activeDocument.activeLayer.translate(-positionValue, -positionValue);
            }
        }

        function align2SelectAll(method) {
            /* 
            AdLf = Align Left
            AdRg = Align Right
            AdCH = Align Centre Horizontal
            AdTp = Align Top
            AdBt = Align Bottom
            AdCV = Align Centre Vertical
            */
            app.activeDocument.selection.selectAll();
            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));
            try {
                executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
            } catch (e) {}
            app.activeDocument.selection.deselect();
        }

        function removeGroup(deleteContained) {
            try {
                var s2t = function (s) {
                    return app.stringIDToTypeID(s);
                };
                var descriptor = new ActionDescriptor();
                var reference = new ActionReference();
                reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
                descriptor.putReference(s2t("null"), reference);
                descriptor.putBoolean(s2t("deleteContained"), deleteContained);
                executeAction(s2t("delete"), descriptor, DialogModes.NO);
            } catch (e) {}
        }

    } else {
        app.beep();
        alert('There is no valid file named "_Resize_Layer_Preference_File.txt" on the desktop!');
    }
}

activeDocument.suspendHistory("Resize selected layers script", "main()");

 

HeyoThereAuteur
Known Participant
August 6, 2022

This code saved a lot of time for my life, I won't suffer anymore, thank you!!!

Stephen Marsh
Community Expert
Community Expert
August 6, 2022

You are welcome!

Stephen Marsh
Community Expert
Community Expert
August 6, 2022

@HeyoThere – I have modified an existing script that I wrote for a similar purpose for you.

 

You first need to run the script on the source layer to capture the dimensions/position. Next, you must select the target layer that you wish to resize to the captured source dimension/position and run a script.

 

This script relies on you manually selecting the source and target layers each time.

 

However, if your text shape target layer was *always* directly above the source layer, or at the very top of the layer stack or always had the same name – then, in that case, this could be automated into a single-step script as the target layer would be known and would not require manual selection.

 

So, can this be simplified into a single step?

HeyoThereAuteur
Known Participant
August 6, 2022

Thank you for responding me, what you described was exactly what I was imagining, selecting the Text layer and running a script to get it's values and then selecting the Shape layer and copying the values. So, there's no need to simplify it into a single step. 

I'm very new to scripting (I literally started today!) so I may have done something wrong. I went in the link you mentioned and got the 2 scripts that you wrote, I pasted them into notepad+ and saved them as 2 separate *.jsx files, then I just recorded and action with each script and it seem like the scripts are running.
But I'm having 2 problems with the scripts, the first is that it doesn't seem to copy the position of the Text Layer in the canvas and the second is that apparently it rasterizes the Shape Layer. 
Maybe you already fixed these problems and you just didn't send the new script yet, but I'm saying it just in case.