• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Empty Smartfilter mask

Explorer ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

Hi,

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

Kind Regards

Joe

TOPICS
Actions and scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Apr 22, 2019 Apr 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) {

...

Votes

Translate

Translate
Adobe
People's Champ ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

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");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

Thanks r-bin , that works great

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

Mr. r-bin

on my photoshop cc14 and cc18 gives me this error.

Schermata-2019-04-22-alle-13-19-34.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

The current layer must have a mask for smart filters.
You can also check the AM property of the layer "hasFilterMask" before this script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 22, 2019 Apr 22, 2019

Copy link to clipboard

Copied

LATEST

Thanks now it works correctly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines