Hello! I have a smart object that I’d like to convert to layers in UXP. In Alchemist, selecting my smart object and clicking “Convert To Layers” generates the following:
const result = await batchPlay(
[
{
_obj: "duplicate",
_target: [
{
_ref: "layer",
_name: ""
},
{
_ref: "layer",
_name: "shadow"
},
{
_ref: "layer",
_name: ""
},
{
_ref: "layer",
_name: "artwork"
},
{
_ref: "layer",
_name: "inner shadow"
},
{
_ref: "layer",
_name: "frame"
},
{
_ref: "layer",
_name: "adjustable frame"
},
{
_ref: "layer",
_name: "3x4 frame"
}
],
to: {
_ref: "document",
_name: "room.psd"
},
destinationDocumentID: 274,
name: "3x4 frame",
version: 5,
ID: [
602,
603,
604,
605,
606,
607,
608,
609
],
_options: {
dialogOptions: "dontDisplay"
}
}
]
I am able to generate this exact object programmatically, but when I run it in batchplay, I get the error The command “Duplicate” is not currently available. I have tried selecting the smart object first, as well as inserting additional keys like layerID: { <the smart object’s ID> } but nothing seems to work.
The only other thing left to do is to open the smart object programmatically, copy the layers, close the smart object doc, and paste the layers, but there has to be a better way!
Thank you in advance for your guidance.
Best,
Tim