Hi. I have a newbie question.
I’m trying to change the value of some text layer by batch play.
I have “layerID” of the target layer.
I can get this result if I change a value manually w/ alchemist listener is on.
So, I made a function like this but it returns error
await batchPlay(
[{
"_obj": "set",
"_target": [
{
"_ref": "textLayer",
"_enum": "ordinal",
"_value": "targetEnum",
"_id": parseInt(layerID)
}
],
"to": [{
"_obj": "textLayer",
"textKey": transString
}],
"_isCommand": false,
"_options": {
"dialogOptions": "dontDisplay"
}
}], {
"synchronousExecution": true,
});
How can I fix this?
I believe this is the problem:
If you want to change current active layer, you do it like:
{
"_ref": "textLayer",
"_enum": "ordinal",
"_value": "targetEnum"
}
If you want to change a specific layer by ID:
{
"_ref": "textLayer",
"_id": parseInt(layerID)
}
Or by name, IIRC:
{
"_ref": "textLayer",
"_name": "Layer name"
}
1 Like
Thank you for your quick response!
I’ve tried the second one, but still crashing
{
“_ref”: “textLayer”,
“_id”: parseInt(layerID)
}
What’s the error? You could check it in console
1 Like
Nothing is printed in debug console.
just error message box is appeared like this.
it’s “could not complete your request because of a program error” in Korean version
Could you check the “Code” tab in Alchemist when you make the change? It generates the exact code to run with BatchPlay. See if that works
1 Like
Wow!
I found the reason thanks to your advice!
There should not “[”, “]” in the “to” section.
Thank you so much!!
1 Like
Wben i execute that code my text sometimes reduces size like 4x. Idk why it is inconsistent