I’m trying to set the text content of the current layer/by layer ID using UXP batchplay. It’s part of a localization plugin that I’m working on, and I’m just missing this last puzzle. “set” and “get” commands are working nicely but not the “set” ones. An error window pops up saying “Could not complete your request because of a program error". I read all discussions on text layers here, but to no avail. Could someone please point me to the right direction? Thanks!
async function setLayerContent() {
var bp = require("photoshop").action.batchPlay;
var command = [
{
"_obj": "set",
"_target": [{
"_ref": "layer",
"_enum": "ordinal", //or "_id": layer._id
"_value": "targetEnum"
}],
"_to": {
"_obj": "layer",
"textKey": "New Text"
},
"_isCommand": true,
"_options": {
"dialogOptions": "dontDisplay"
}
}
]
var result = await bp(command, {});
console.log(result);
}
Error log:
Photoshop Error information
Code: -1715
Text: because of a program error
Message: Could not complete your request because of a program error.
Stack:
Adobe Photoshop 22.4.3 20210708.r.317 bb896cc
0 address: 0x114e3c5dd base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘0 Adobe Photoshop 2021 0x0000000114e3c619 Adobe Photoshop 2021 + 86574617’
1 address: 0x112ca6bd4 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘1 Adobe Photoshop 2021 0x0000000112ca6bd4 Adobe Photoshop 2021 + 51358676’
2 address: 0x112ca7295 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘2 Adobe Photoshop 2021 0x0000000112ca7295 Adobe Photoshop 2021 + 51360405’
3 address: 0x1119acae1 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘3 Adobe Photoshop 2021 0x00000001119acae1 Adobe Photoshop 2021 + 31460065’
4 address: 0x1119c00aa base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘4 Adobe Photoshop 2021 0x00000001119c00aa Adobe Photoshop 2021 + 31539370’
5 address: 0x1119b4115 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘5 Adobe Photoshop 2021 0x00000001119b4115 Adobe Photoshop 2021 + 31490325’
6 address: 0x11189bf6b base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘6 Adobe Photoshop 2021 0x000000011189bf6b Adobe Photoshop 2021 + 30343019’
7 address: 0x1108d0f58 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘7 Adobe Photoshop 2021 0x00000001108d0f58 Adobe Photoshop 2021 + 13782872’
8 address: 0x110a887cf base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘8 Adobe Photoshop 2021 0x0000000110a887cf Adobe Photoshop 2021 + 15583183’
9 address: 0x110a8adba base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘9 Adobe Photoshop 2021 0x0000000110a8adba Adobe Photoshop 2021 + 15592890’
10 address: 0x110a8a4fe base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘10 Adobe Photoshop 2021 0x0000000110a8a4fe Adobe Photoshop 2021 + 15590654’
11 address: 0x112ca1c65 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘11 Adobe Photoshop 2021 0x0000000112ca1c65 Adobe Photoshop 2021 + 51338341’
12 address: 0x112c9f3e1 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘12 Adobe Photoshop 2021 0x0000000112c9f3e1 Adobe Photoshop 2021 + 51327969’
13 address: 0x112c8a818 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘13 Adobe Photoshop 2021 0x0000000112c8a818 Adobe Photoshop 2021 + 51243032’
14 address: 0x112c8a924 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘14 Adobe Photoshop 2021 0x0000000112c8a924 Adobe Photoshop 2021 + 51243300’
15 address: 0x112b8b54d base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘15 Adobe Photoshop 2021 0x0000000112b8b54d Adobe Photoshop 2021 + 50197837’
16 address: 0x145fb5065 base: 0x145f17000 module name: ‘Spaces’ symbol info: ‘16 Spaces 0x0000000145fb5065 _Z20PG_SendEventOverrideP11objc_objectP13objc_selectorP7NSEvent + 261’
17 address: 0x7fff30c34daf base: 0x7fff30c03000 module name: ‘AppKit’ symbol info: ‘17 AppKit 0x00007fff30c34daf -[NSApplication run] + 707’
18 address: 0x112b8c022 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘18 Adobe Photoshop 2021 0x0000000112b8c022 Adobe Photoshop 2021 + 50200610’
19 address: 0x112b8e580 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘19 Adobe Photoshop 2021 0x0000000112b8e580 Adobe Photoshop 2021 + 50210176’
20 address: 0x112c8b0ec base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘20 Adobe Photoshop 2021 0x0000000112c8b0ec Adobe Photoshop 2021 + 51245292’
21 address: 0x112737068 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘21 Adobe Photoshop 2021 0x0000000112737068 Adobe Photoshop 2021 + 45658216’
22 address: 0x10fbb1809 base: 0x10fbac000 module name: ‘Adobe Photoshop 2021’ symbol info: ‘22 Adobe Photoshop 2021 0x000000010fbb1809 Adobe Photoshop 2021 + 22537’
23 address: 0x7fff6d9f8cc9 base: 0x7fff6d9de000 module name: ‘libdyld.dylib’ symbol info: ‘23 libdyld.dylib 0x00007fff6d9f8cc9 start + 1’