Skip to main content
Participating Frequently
February 16, 2020
Answered

How to disable the warning " No pixel is highlighted by more than 50%"?

  • February 16, 2020
  • 3 replies
  • 7467 views

Hello everyone.

Tell me how I can disable the warning " Attention: No pixel is highlighted by more than 50%. The borders of the selected area will not be visible."during the execution of my script?

I tried to write at the beginning of the script 
app.displayDialogs = DialogModes.NO;
but it did not help.
This topic has been closed for replies.
Correct answer r-bin
This is a bug.
I will see what can be done later. Now there is no time.

For any other channels, except RGB, everything works.

Another bug occurs when you use (for any channel)
executeAction (idsetd, desc113, DialogModes.ALL);
Not sure that they will fix it.
 
If you set
var idRGB = stringIDToTypeID ("gray");

then Photoshops CS6 - CC2020 crashes !!
They definitely have to fix it!!!
 
EDIT:
If you need this selection to create a mask, it’s easier to use AppyImage to an already created mask.
 
EDIT: 27/02/2020
If you are satisfied, then you can make a selection not from the composite RGB channel, but only from the red (or green) channel.
In this case, there will be no messages.
 

 

// make selection from red channel

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("red"));
    d.putReference(stringIDToTypeID("to"), r1);
    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { alert(e); }



If you still need to make selection only from the composite RGB channel, the code below will do this and there will also be no messages.

 

 

 

try {
    // make temp black alpha channel

    var d = new ActionDescriptor();
    var d1 = new ActionDescriptor();
    d1.putEnumerated(stringIDToTypeID("colorIndicates"), stringIDToTypeID("maskIndicator"), stringIDToTypeID("maskedAreas"));
    var d2 = new ActionDescriptor();
    d2.putDouble(stringIDToTypeID("red"), 255);
    d2.putDouble(stringIDToTypeID("green"), 0);
    d2.putDouble(stringIDToTypeID("blue"), 0);
    d1.putObject(stringIDToTypeID("color"), stringIDToTypeID("RGBColor"), d2);
    d1.putInteger(stringIDToTypeID("opacity"), 50);
    d.putObject(stringIDToTypeID("new"), stringIDToTypeID("channel"), d1);
    executeAction(stringIDToTypeID("make"), d, DialogModes.NO);

    // apply RGB to alpha channel

    var d = new ActionDescriptor();
    var d1 = new ActionDescriptor();
    var r = new ActionReference();
    r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("RGB"));
    r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("merged"));
    d1.putReference(stringIDToTypeID("to"), r);
    d1.putBoolean(stringIDToTypeID("preserveTransparency"), true);
    d.putObject(stringIDToTypeID("with"), stringIDToTypeID("calculation"), d1);
    executeAction(stringIDToTypeID("applyImageEvent"), d, DialogModes.NO);

    // make selection from alpha channel

    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("ordinal"), stringIDToTypeID("targetEnum"));
    d.putReference(stringIDToTypeID("to"), r1);
    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    var d = new ActionDescriptor();

    // delete temp alpha channel

    var r = new ActionReference();
    r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
    d.putReference(stringIDToTypeID("null"), r);
    executeAction(stringIDToTypeID("delete"), d, DialogModes.NO);
    }
catch (e) { alert(e); }
​

 

 
P.S. I can not add a new post. The forum is buggy. I had to change the old post.
 

 

3 replies

Legend
February 26, 2020
Finally I managed to add a message. The solution is in the last message.
 
Kukurykus
Legend
July 2, 2021

Perhaps you know how to read whether Masked / Selected Areas are checked in Quick Mask Options?

Legend
July 2, 2021
if (!app.activeDocument.quickMaskMode) app.activeDocument.quickMaskMode = true;

select_quick_mask();
alert(channel_color_indicates())

function select_quick_mask()
    {
    try { 
        var d = new ActionDescriptor();
        var r = new ActionReference();

        r.putName(stringIDToTypeID("channel"), "Quick Mask");
        d.putReference(stringIDToTypeID("null"), r);
        executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

        var d = new ActionDescriptor();
        var r = new ActionReference();
        r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("RGB"));
        d.putReference(stringIDToTypeID("null"), r);
        executeAction(stringIDToTypeID("show"), d, DialogModes.NO);
        }
    catch (e) { throw(e); } 
    }

function channel_color_indicates()
    {
    try {
        var r = new ActionReference();
        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID( "alphaChannelOptions" ) );
        r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

        var ret = executeActionGet(r).getObjectValue(stringIDToTypeID("alphaChannelOptions")).getEnumerationValue(stringIDToTypeID("colorIndicates"));

        if (ret == stringIDToTypeID("selectedAreas")) return true;

        return false;
        }
    catch (e) { throw(e); } 
    }
r-binCorrect answer
Legend
February 17, 2020
This is a bug.
I will see what can be done later. Now there is no time.

For any other channels, except RGB, everything works.

Another bug occurs when you use (for any channel)
executeAction (idsetd, desc113, DialogModes.ALL);
Not sure that they will fix it.
 
If you set
var idRGB = stringIDToTypeID ("gray");

then Photoshops CS6 - CC2020 crashes !!
They definitely have to fix it!!!
 
EDIT:
If you need this selection to create a mask, it’s easier to use AppyImage to an already created mask.
 
EDIT: 27/02/2020
If you are satisfied, then you can make a selection not from the composite RGB channel, but only from the red (or green) channel.
In this case, there will be no messages.
 

 

// make selection from red channel

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("red"));
    d.putReference(stringIDToTypeID("to"), r1);
    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { alert(e); }



If you still need to make selection only from the composite RGB channel, the code below will do this and there will also be no messages.

 

 

 

try {
    // make temp black alpha channel

    var d = new ActionDescriptor();
    var d1 = new ActionDescriptor();
    d1.putEnumerated(stringIDToTypeID("colorIndicates"), stringIDToTypeID("maskIndicator"), stringIDToTypeID("maskedAreas"));
    var d2 = new ActionDescriptor();
    d2.putDouble(stringIDToTypeID("red"), 255);
    d2.putDouble(stringIDToTypeID("green"), 0);
    d2.putDouble(stringIDToTypeID("blue"), 0);
    d1.putObject(stringIDToTypeID("color"), stringIDToTypeID("RGBColor"), d2);
    d1.putInteger(stringIDToTypeID("opacity"), 50);
    d.putObject(stringIDToTypeID("new"), stringIDToTypeID("channel"), d1);
    executeAction(stringIDToTypeID("make"), d, DialogModes.NO);

    // apply RGB to alpha channel

    var d = new ActionDescriptor();
    var d1 = new ActionDescriptor();
    var r = new ActionReference();
    r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("RGB"));
    r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("merged"));
    d1.putReference(stringIDToTypeID("to"), r);
    d1.putBoolean(stringIDToTypeID("preserveTransparency"), true);
    d.putObject(stringIDToTypeID("with"), stringIDToTypeID("calculation"), d1);
    executeAction(stringIDToTypeID("applyImageEvent"), d, DialogModes.NO);

    // make selection from alpha channel

    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("ordinal"), stringIDToTypeID("targetEnum"));
    d.putReference(stringIDToTypeID("to"), r1);
    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    var d = new ActionDescriptor();

    // delete temp alpha channel

    var r = new ActionReference();
    r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
    d.putReference(stringIDToTypeID("null"), r);
    executeAction(stringIDToTypeID("delete"), d, DialogModes.NO);
    }
catch (e) { alert(e); }
​

 

 
P.S. I can not add a new post. The forum is buggy. I had to change the old post.
 

 

Kukurykus
Legend
February 18, 2021

So was that problem with Russian version of Photoshop?

Legend
February 18, 2021

Whom and what exactly are you asking about?

 

Legend
February 16, 2020
Find the line that causes the message.
Insert 

 

alert(app.displayDialogs);

 

in front of it.

Perhaps somewhere in the script there is a change in this parameter (or you call a third-party script that changes this parameter).
 
P.S. Photoshop actually produces a slightly different message in English. Perhaps you have a free translation.
 
 
Participating Frequently
February 16, 2020

Thanks for the answer! I inserted this code literally before each line of my script, each time I received the message "DialogModes.NO". But the warning is "Attention: No pixel is highlighted by more than 50%. The borders of the selected area will not be visible." appears anyway. Is there another way that I can try?

Perhaps in the Russian version of Photoshop, the warning was not correctly translated or Google translator did not accurately translate my message from Russian into English.

c.pfaffenbichler
Community Expert
Community Expert
February 16, 2020

I am afraid that particular warning (about no pixels being more than 50% selected) may be an unavoidable botherance at current.  

 

Feel free to add your vote to a Feature Request concerning it: 

Photoshop: Remove unnecessary warnings like "No pixels are more than 50% selected. The selection edges will not be visible"