Skip to main content
Joachim Hiller
Known Participant
April 22, 2019
Answered

Empty Smartfilter mask

  • April 22, 2019
  • 1 reply
  • 1390 views

Hi,

is there a possibility to check if the smartfilter mask is pure white?

Kind Regards

Joe

This topic has been closed for replies.
Correct answer r-bin

Try

var d = new ActionDescriptor();

var r = new ActionReference();

r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));

d.putReference(stringIDToTypeID("null"), r);

var r1 = new ActionReference();

r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("filterMask"));

d.putReference(stringIDToTypeID("to"), r1);

executeAction(stringIDToTypeID("set"), d, DialogModes.NO);

var pure_white = true;

try { app.activeDocument.selection.bounds; } catch (e) { pure_white = false; }

if (pure_white)

    {

    app.activeDocument.selection.invert();

    try { app.activeDocument.selection.bounds; pure_white = false; } catch (e) {}

    app.activeDocument.selection.deselect();

    }

alert(pure_white?"Pure white":"Not Pure white");

1 reply

r-binCorrect answer
Legend
April 22, 2019

Try

var d = new ActionDescriptor();

var r = new ActionReference();

r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));

d.putReference(stringIDToTypeID("null"), r);

var r1 = new ActionReference();

r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("filterMask"));

d.putReference(stringIDToTypeID("to"), r1);

executeAction(stringIDToTypeID("set"), d, DialogModes.NO);

var pure_white = true;

try { app.activeDocument.selection.bounds; } catch (e) { pure_white = false; }

if (pure_white)

    {

    app.activeDocument.selection.invert();

    try { app.activeDocument.selection.bounds; pure_white = false; } catch (e) {}

    app.activeDocument.selection.deselect();

    }

alert(pure_white?"Pure white":"Not Pure white");

Joachim Hiller
Known Participant
April 22, 2019

Thanks r-bin , that works great