Hi,
What’s the correct way to return an array of the existing layers and the length of that array with UXP for Photoshop?
I’m having trouble understanding the result when I access: require(“photoshop”).app.activeDocument.layers.length
Here’s some test code:
async function test_modal_function(){
console.log(“test_modal_function”)
console.log(require(“photoshop”).app.activeDocument.layers.length)
console.log(“end test_modal_function”)
}
async function runModalFunction_test_modal_function() {
await executeAsModal(test_modal_function, {“commandName”: “test_modal_function”});
}
Here’s the log:
runModalFunction_test_modal_function()
Promise {}
test_modal_function
layers.length 1
end test_modal_function
Here’s a screenshot of the layers panel:
What am I doing wrong?
Thanks!