Delete individual Channels?

Apologies if this is a silly question: can someone explain why there appears not to be a method for deleting individual channels, it looks like it’s only possible via batchplay?

Thank you!

Hey man!

You can remove individual channels with the DOM or the BatchPlay too.

Here’s a DOM function to remove a given channel to the function, you pass inside the function the channel’s name that you want to remove.

I put some comments on lines for better understanding.

// The function takes the channel name you want to delete as a parameter
    // there you put the name of the channel you want to get
    await removeChannel('Alpha 1');

    // Remove channel function
    async function removeChannel(channelName) {

      //In order to make work the function, its code needs to be executed under modal
      await require('photoshop').core.executeAsModal(async () => {

        const channels = app.activeDocument.channels;
        const channelToDelete = await channels.getByName(channelName);
        await channelToDelete.remove();

      });
    }

This works for me.

Make sure your Api version is “2” within your manifest file.

"host": [
    {
      "app": "PS",
      "minVersion": "23.0.0",
      "data": {
        "apiVersion": 2, // This needs to be 2
        "loadEvent": "use"
      }
    }
  ],
1 Like

You continue to be my hero, @photonic

1 Like