How do I get a filter ID?

Hi,
I am creating my own plugin actions to run installed filters.
I noticed that each filter has it’s own ID,
E.g. I can run it using:

async function myRunAction(isLayerMask, displayOptions, actionObject) {
await require(“photoshop”).core.executeAsModal(async (executionControl, descriptor) => {
const result = await batchPlay(
[
{
_obj: actionObject,
$IsMB: isLayerMask,
$IsHB: 0,
$SenF: 100,
_options: {
dialogOptions: displayOptions
}
}
],
{
synchronousExecution: false,
modalBehavior: “execute”
});
});
}

The actionObject can be “a6e0kl2a-95ce-11d3-bd6b-93khdf9he1al”
Id this unique for each plugin or is this computer dependent?
How can i get a list of all installed filters and their IDs?
I’d like to let the user choose a filter from a list and I want to map the ID to the filter name installed on the machine.

1 Like

I have never seen the filter IDs, but I have only used javascript uxp for a short time.

If you need access to Photoshop’s filters, you could use the DOM, which is already available for many popular filters.

https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/layer/#methods

Thank but those are not built in filters. I refer to filters under the filter menu which i download.
they are actually plugins which you can find under the filter menu

I’d like to know this too. I want to invoke a 3rd party filter. Using Alchemist I can see that the current filter ID is a GUID which can be used in batchPlay to invoke it:

async function actionCommands() {
   const result = await batchPlay(
      [
         {
            _obj: "a6e0kl2a-95ce-11d3-bd6b-93khdf9he1al",
            $IsMB: true,
            $IsHB: 0,
            $SenF: 90,
            _options: {
               dialogOptions: "dontDisplay"
            }
         }
      ],
      {}
   );
}

Seems like my code should lookup the ID of the filter instead of having that value hard-coded. Is there a way to do that in UXP?

I managed to get the filters using this:

async function getLayerFilters() {
   const result = await batchPlay(
      [
         {
            _obj: "get",
            _target: [
               {
                  _property: "smartObject"
               },
               {
                  _ref: "layer",
                  _enum: "ordinal",
                  _value: "targetEnum"
               }
            ],
            _options: {
               dialogOptions: "dontDisplay"
            }
         }
      ],
      {}
   );
   const pinned = result[0].smartObject.filterFX;
   return pinned;
}

That seems like it is getting what filters have been applied to a layer. I am trying to pull a list of filters available so that I can apply the correct 3rd party filter without having something break the next time the 3rd party updates the filter.