I’m getting the error “The Command “Copy” is not available”. I got this code directly from Alchemist. I’m not sure if the issue is with the generated code or if the issue is on the Photoshop side.
This should Select All and then Copy. I tried on a flattened image and also on a single layer image with a normal (not background) layer. In either case it gives the same message. It does do the Select All part. The copy command is available in the Photoshop menu. I also tried just the copy batchPlay command with a selection already made which gives the same message.
I would expect this error if the active layer was an adjustment layer or something that couldn’t be copied. but it is just a normal layer. I also tried using “cut” and it did the same thing.
If it is a bug in the Photoshop side then I will report the issue. However, I’m not sure if the bug is with Photoshop or with the generated code.
const batchPlay = require("photoshop").action.batchPlay;
const result = await batchPlay(
[
{
"_obj": "set",
"_target": [
{
"_ref": "channel",
"_property": "selection"
}
],
"to": {
"_enum": "ordinal",
"_value": "allEnum"
},
"_isCommand": false,
"_options": {
"dialogOptions": "dontDisplay"
}
},
{
"_obj": "copyEvent",
"_isCommand": false,
"_options": {
"dialogOptions": "dontDisplay"
}
}
],{
"synchronousExecution": false,
"modalBehavior": "fail"
});