Batchplay Loop synchronous not working

I want to replace content synchronous each layer.
I tried to this code

async function replaceContentsLoop(image, layerList) {
  try {
    await core.executeAsModal(() => {
      const result = action.batchPlay(
        layerList.map((layer) => {
          return {
            _obj: 'placedLayerReplaceContents',
            null: {
              _path: fs.createSessionToken(image),
              _kind: 'local',
            },
            layerID: layer._id,
            _options: {
              dialogOptions: 'dontDisplay',
            },
          };
        }),
        {
          synchronousExecution: true,
        },
      );

      console.log(result);
    });
  } catch (e) {
    console.log('replaceContents', e);
  }
}

And actionDescripton array is this

But its working at same layer

how can i fix it ??

layerID is read-only information when you listen to the event. But when you execute the event it has no use and is ignored. You should select a layer before executing the action.

I can’t understand the meaning of “select a layer before executing the action” :pleading_face::pleading_face:
Isn’t that code also selecting a layer before executing the action too ?


I SOLVED IT !!!

1 Like