The command “Copy Merged” is not currently available. - copyMerged

Hey Guys,

I’m having some issues executing the copyMerged command.

I’m receiving:
The command “Copy Merged” is not currently available.

const result = await this.batchPlay(
          [
             {
                _obj: "copyMerged",
                _isCommand: true,
                _options: {
                   dialogOptions: "dontDisplay"
                }
             }
          ],{
             synchronousExecution: false,
             modalBehavior: "execute"
          });

Any possible tips?

Thanks for the help

Hey,
probably because there isn’t any selection active before you called batchPlay.
If you select something, and then run the following, then it works

await batchPlay(
[
   {
      "_obj": "copyMerged",
      "_isCommand": true,
      "_options": {
         "dialogOptions": "dontDisplay"
      }
   }
],{
   "synchronousExecution": false,
   "modalBehavior": "fail"
});

Hey @Pierre_G ,

Thanks for your response. I’m actually running a selection command before I do it.

const result = await this.batchPlay(
          [
             {
                _obj: "set",
                _target: [
                   {
                      _ref: "channel",
                      _property: "selection"
                   }
                ],
                to: {
                   _enum: "ordinal",
                   _value: "allEnum"
                },
                _isCommand: true,
                _options: {
                   "dialogOptions": "dontDisplay"
                }
             }
          ],{
             synchronousExecution: false,
             modalBehavior: "execute"
          });      

Do you think I might be selecting the wrong channels?

Cheers

This makes a channel active but it’s not selecting its content …

If I run the commands by hand “select/all” and “edit/copymerge” it works perfectly :confused:

Yes, so you’ d have to make a batchPlay for this step too :slight_smile:

I have it…

running alchemy on the background the 2 steps are.

const result = await this.batchPlay(
        [
          {
              "_obj": "set",
              "_target": [
                {
                    "_ref": "channel",
                    "_property": "selection"
                }
              ],
              "to": {
                "_enum": "ordinal",
                "_value": "allEnum"
              },
              "_isCommand": true,
              "_options": {
                "dialogOptions": "dontDisplay"
              }
          }
        ],{
          "synchronousExecution": false,
          "modalBehavior": "execute"
        });

And

 const result = await this.batchPlay(
          [
             {
                "_obj": "copyMerged",
                "_isCommand": true,
                "_options": {
                   "dialogOptions": "dontDisplay"
                }
             }
          ],{
             "synchronousExecution": false,
             "modalBehavior": "execute"
          });

But yet still not working.

These steps are not the correct ones. What are you trying to do? Select a channel and then CopyMerge it ?

Yep, it is basically a step of a long process, but I want to select all layers to generate a flattened image, not flattening the file ( copyMerged function under edit ). The selection seems to work as I get the dotted line on the surrounding of the whole image. But I’m still getting the message, The command “Copy Merged” is not currently available, after doing the selection batchPlay.

That’s again something else. If you just want to flatten the file then there is a much simple approach.

Yeah, I’ve used the .flatten(); that came from the PS library itself for some of the other actions I have. But what I need for this specific one is a new layer that is the “merged” version of all of the other layers. Basically what selecting all ctrl+a / copyMerged / paste would do.

How about using “Stamp Visible” then ?
You merga all layers onto a new one.

Ctrl + Shift + Alt keys , and then tap the letter “e”
(Mac = Command + Shift + Option, then tap “e”)

Ha! Bingo @Pierre_G ! That works like a charm!

 const result = await this.batchPlay(
        [
          {
              "_obj": "mergeVisible",
              "duplicate": true,
              "_isCommand": true,
              "_options": {
                "dialogOptions": "dontDisplay"
              }
          }
        ],{
          "synchronousExecution": false,
          "modalBehavior": "execute"
        });

I owe you a nice cold pint any time you pop by London.

With pleasure :slight_smile: In the meantime, have a couple of pints for me :sweat_smile:

BTW, you can reduce it to

await batchPlay(
    [{
        "_obj": "mergeVisible",
        "duplicate": true
    }], {});