UXP get Text Layer contents

Ok last question before I make this damn plugin - Does anyone know if it’s possible to use UXP or JavaScript to get the Contents of a Text layer?

For example, I have a text layer called “Foo”, it’s contents/Text is “Bar”

Is there any code that can get the content/Text of the layer “Foo”

const batchPlay = require("photoshop").action.batchPlay;

const result = await batchPlay(
    [{
        "_obj": "get",
        "_target": [{
            "_ref": "layer",
            "_enum": "ordinal",
            "_value": "targetEnum"
        }],
        "_options": {
            "dialogOptions": "dontDisplay"
        }
    }], {
        "synchronousExecution": true,
    })[0].textKey.textKey;
console.log(result);
1 Like

Thank you so much Pierre, super helpful posting code

1 Like