Hi,
I’m encountering a strange behavior when using batchPlay code within a function.
I usually wrap my batchPlay code in function like that:
const makeChannelMixer = async (cv, mv, yv, bv, constant) => {
await batchPlay(
[
{
_obj: "make",
_target: [
{
_ref: "adjustmentLayer"
}
],
using: {
_obj: "adjustmentLayer",
type: {
_obj: "channelMixer",
presetKind: {
_enum: "presetKindType",
_value: "presetKindCustom"
},
monochromatic: true,
gray: {
_obj: "channelMatrix",
cyan: {
_unit: "percentUnit",
_value: cv
},
magenta: {
_unit: "percentUnit",
_value: mv
},
yellowColor: {
_unit: "percentUnit",
_value: yv
},
black: {
_unit: "percentUnit",
_value: bv
},
constant: {
_unit: "percentUnit",
_value: constant
}
}
}
},
_options: {
dialogOptions: "dontDisplay"
}
}
],{});
};
Calling that function using parameters and not only fixed values worked perfectly fine with API 1:
makeChannelMixer(25,25,25,25,0);
Since I use API 2 – and therefore executeAsModal – using parameters with the function call doesn’t work anymore. Nothing happens when calling that function:
await require('photoshop').core.executeAsModal(makeChannelMixer(25,25,25,25,0));
But it does work without the use of parameters (of course with fixed values in the batchPlay code):
await require('photoshop').core.executeAsModal(makeChannelMixer);
@kerrishotts It seems like a bug to me, but maybe I miss something completely obvious?!
Thanks