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

Community Beginner ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

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.
TOPICS
Actions and scripting, How to

Views

896

Likes

translate

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

Adobe Community Professional , Feb 17, 2020 Feb 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 setvar 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/2020If ...

Likes

translate

Translate

Translate
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

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.
 
 

Likes

translate

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
Community Beginner ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

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.

Likes

translate

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
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

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: 

https://feedback.photoshop.com/photoshop_family/topics/pop-up-boxes

Likes

translate

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
Community Beginner ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

Thanks, I voted for this feature. Perhaps there is a way to automate the processing of this event using javascript? I would like to process a large number of files using a script, leaving execution overnight. But because of this warning, execution is interrupted and in the morning I find that only 50-100 photos were processed. It would be great if it were possible to click "OK" automatically

Likes

translate

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
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

I think I read (at least) once about the possibility of triggering a keypress event in a Script with a timer (like every X secons the Script will simulate hitting the enter-key.) 

Naturally that would be platform-dependent – are you working on Windows or Mac?  

 

Maybe you can find something on this Forum (as the Photoshop Scripting Forum is no longer separate) or over on 

https://www.ps-scripts.com/bb/

or even on more general JavaScript-Fora. 

Likes

translate

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
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

/bb/ part is no needed 😉

Likes

translate

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
Community Beginner ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

I work on windows. Unfortunately on ps-scripts.com I did not find a solution. Perhaps the reason is that the warning text in the Russian version of Photoshop is a little different and the search does not give all the results. Will pressing Enter on the timer interfere with script execution if there is no warning moment and another operation is being performed?

 

Likes

translate

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
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

It's easy to by pass it by a script. Simply change selection to pathItem and then back to selection. Next step is to check if selection is still available. If it's not then you know the original selection had not enough (at all) selected pixels (as it sometimes happens, but is still like it existed - kind of bug). I saw topics about this problem on this forum. Since I often meet it I wrote something myself.

 

sTT = stringIDToTypeID; dsc = new ActionDescriptor(), ref2 = new ActionReference();
(ref1 = new ActionReference()).putClass(sTT('path')); dsc.putReference(sTT('null'), ref1)
ref2.putProperty(sTT('selectionClass'), sTT('selection')), dsc.putReference(sTT('from'), ref2)
dsc.putUnitDouble(sTT('tolerance'), sTT('pixelsUnit'), 0.5), executeAction(sTT('make'), dsc)

dsc = new ActionDescriptor(), ref2 = new ActionReference();
(ref1 = new ActionReference()).putProperty(sTT('channel'), sTT('selection'))
dsc.putReference(sTT('null'), ref1); ref2.putProperty(sTT('path'), sTT('workPath'))
dsc.putReference(sTT('to'), ref2), executeAction(sTT('set'), dsc);

(ref = new ActionReference()).putProperty(sTT('property'), sTT('selection'))
ref.putEnumerated(sTT('document'), sTT('ordinal'), sTT('targetEnum'))
if (executeActionGet(ref).hasKey(sTT('selection')))
	aD.activeHistoryState = (hS = (aD = activeDocument)
	.historyStates)[hS.length - (3)]
else{
	/*do what you do when there's no selection*/
}

 

Likes

translate

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
Adobe Community Professional ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

Need your script.
I suspect that this message appears after the code like
doc.selection.invert ();

Also try to reset (delete) prefenences.
Here it is written how to do it
 

Likes

translate

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
Community Beginner ,
Feb 16, 2020 Feb 16, 2020

Copy link to clipboard

Copied

part of my scierium in which a warning occurs

 

    function selectRGB(){
        app.displayDialogs = DialogModes.NO;
        var idsetd = charIDToTypeID( "setd" );
            var desc113 = new ActionDescriptor();    
            var idnull = charIDToTypeID( "null" ); 
                var ref41 = new ActionReference(); 
                var idChnl = charIDToTypeID( "Chnl" );     
                var idfsel = charIDToTypeID( "fsel" );    
                ref41.putProperty( idChnl, idfsel );   
            desc113.putReference( idnull, ref41 );
            var idT = charIDToTypeID( "T   " );
                var ref42 = new ActionReference();
                var idChnl = charIDToTypeID( "Chnl" );
                var idChnl = charIDToTypeID( "Chnl" );                     
                var idRGB = charIDToTypeID( "RGB " );                
                ref42.putEnumerated( idChnl, idChnl, idRGB );                
            desc113.putReference( idT, ref42 );             
        executeAction( idsetd, desc113, DialogModes.NO );
        }
    
    app.displayDialogs = DialogModes.NO;
    selectRGB();

 

I got it using a scriptlistener, made a function, and added the lines app.displayDialogs = DialogModes.NO.  Reset unfortunately did not help, but thanks for the option

 

Likes

translate

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
Adobe Community Professional ,
Feb 17, 2020 Feb 17, 2020

Copy link to clipboard

Copied

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.
 

 

Likes

translate

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
Adobe Community Professional ,
Feb 17, 2021 Feb 17, 2021

Copy link to clipboard

Copied

So was that problem with Russian version of Photoshop?

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Whom and what exactly are you asking about?

 

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

One of you 😉 I'm asking as I can't reproduce this bug creating new document and using this code.

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Is your RGB channel (document layer) black?

 

P.S. Localization doesn't matter. I have English Photoshop if that. 

 

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

I found now with black and grey layer there are 2 different warnings, in CC and CS releases.

 

I did that manually and by script, and hmm is that really bug or intentional behaviour?

 

I don't know how today I ended in this topic, but it's exact year from your post 🙂

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

The bug is the fact that the message appears despite the DialogModes.NO mode.
What does "international behavior" have to do with it?
 
 
 

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Intentional*, ie. planned by engineers, so something that had to occur normally.

 

I found also the second step in your workaround (apply RGB to alpha channel) is not needed, or it is but I don't understand what for? Anyway without it, the effect is same for black / grey layer.

 

btw I think it might be side effect, so not the bug, but something that happens, like here.:

 

- make document

- make 1x1 pixel selection

- make work path from this selection with tolerance 0.5 pixles

- make selection from pathItem with two pixels for feather radius

 

As you will see you'll get the same alert (also by script with DialogModes.NO):

 

"Warning: No pixels are more than 50% selcted. The selection Edges will not be visible."

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Your example with a small path is quite rare in real practice.

I don't know how to get around this yet.

 

And I did not understand your remark about the unnecessary step with ApplyImage.

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

I use automation to select little parts of image (in random spots of thousand different images every day). The selection is feathered, so when script contract the selection (for specific results), it is often present but not seen (for eye), so like in given example. For me it is not so rare then 😉 Of course most selections are enough big, but if not, then it's not possible to make pathItems from them. Then to avoid that 'bug' I check selection existence.

 

Regarding ApplyImage step (when layer is grey/black) it's not needed to get the same result, is it?

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

I didn't understand about "the effect was the same". Absolutely! What is it about?
It won't work without this step.
 
About the path.
Have you tried making a selection with feather = 0 and then applying the desired one?
 

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Yes, I always use 0 px feather when I do selection from path. The 2 pixels were as example only. The problem occurs when making path from selection. Because if selection is too small and too feathered the path will not be created (however any warning fortunately doesn't happen then).

 

As to the "the effect was the same" without that second step in your script: make document, fill with grey or black, then run your script without ApplyImage. The result is the same like with the ApplyImage, isn't it?

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

In this case, you will not have a selection at all, since you will create it from a black empty alpha channel.

Likes

translate

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
Adobe Community Professional ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

You are right. I tried it with grey layer and I see now without ApplyImage there was no selection.

Likes

translate

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