Execute 3rd party filter on a layer?

End goal: Apply a filter provided by a 3rd party to a layer.

Using alchemist to capture the BatchPlay command, this works exactly like I need for my end goal:

const apply3rdPartyFilter = async (layerName) => {
    return executeAsModal(async () => {
        command = [
            // Deactivate all layers
            {
                _obj: "selectNoLayers",
                _target: [
                    {
                        _ref: "layer",
                        _enum: "ordinal",
                        _value: "targetEnum"
                    }
                ],
                _options: {
                    dialogOptions: "dontDisplay"
                }
            },
            // Select the layer the 3rd party filter should be applied to
            {
                _obj: "select",
                _target: [
                    {
                        _ref: "layer",
                        _name: layerName
                    }
                ],
                makeVisible: false,
                _options: {
                    dialogOptions: "dontDisplay"
                }
            },
            // apply 3rd party filter
            {
                _obj: "a6e0kl2a-95ce-11d3-bd6b-93khdf9he1al",
                $IsMB: true,
                $IsHB: 0,
                $SenF: 90,
                _options: {
                    dialogOptions: "dontDisplay"
                }
            }
        ]
        await batchPlay(command, {})
    }, { commandName: "apply3rdPartyFilter" })
        .then(res => console.log("apply3rdPartyFilter:success"))
        .catch(err => {
            throw new Error("apply3rdPartyFilter:err ", err)
        });
}

The problem is the obj value is hard coded to one that I am doubtful will remain consistent over time.

I also tried getting command ID for the 3rd party filter via the menuBarInfo object and then calling it:

const apply3rdPartyFilter = async () => {
    let filterMenuString = translateUIString("$$$/Menu/Filter");

    const menuBarInfo = await executeAsModal(async () => {
        let r = await batchPlay([
            {
                "_obj": "get",
                "_target": [{"_property": "menuBarInfo"},{"_ref": "application", "_enum": "ordinal", "_value": "targetEnum"}]
                    }
        ], {})
        console.log(r[0])
        return r[0].menuBarInfo;
    }, { commandName: "getMenuBarInfo" })

    commandId = menuBarInfo.submenu.find( menu => menu.name == filterMenuString )
        .submenu.find( filterGroup => filterGroup.title = '3rdPartyGroup' && filterGroup.kind=="main")
        .submenu.find( filter => filter.title = '3rdPartyFilter')
        .command
    console.log(`commandId: ${commandId}`)

    await core.performMenuCommand({ commandID: commandId })
}

Problem with this is the the commandId is -398 on my computer, which of course does not invoke the 3rd party filter (the layer gets a “Generate Bump (Height) Map” applied).

Is there any way to invoke a 3rd Party filter without using a hard-coded obj value that seems very likely to change?

I don’t think _obj should ever change. Unless 3rd party author explicitly decides to change it. This actually prevents conflicts in naming. Because you could have 4 frequency separation plugins each calling their action freqSep and PS wouldn’t know which one to run.

But I might be wrong. You should check plugin SDK docs.

Thanks @Jarda I’ll have to dig through the SDK docs to see if I can find out.