How create a clipping mask?

I find some old tips say set .grouped = true can do it in Extendscript, but how do it use UXP API?
sorry, i just beging to learn script. :joy:

Hi, you can use this code to create a Clipping Mask from the selected active layer

const batchPlay = require("photoshop").action.batchPlay;

async function createClippingMask() {
  await batchPlay(
    [{
      _obj: "groupEvent",
      _target: [{
        _ref: "layer",
        _enum: "ordinal",
        _value: "targetEnum"
      }],
      _isCommand: true,
      _options: {
        dialogOptions: "dontDisplay"
      }
    }], {
      synchronousExecution: false,
      modalBehavior: "fail"
    });
}

I’m using this fantastic Photoshop plugin for UXP “Alchemist” by @Jarda :+1:
You can grab the developper version for free here GitHub - jardicc/alchemist
Highly recommended :wink:

1 Like

thank you !!! :pray: