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?
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
alert(app.displayDialogs);
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.
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:
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
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 ps-scripts or even on more general JavaScript-Fora.
Copy link to clipboard
Copied
/bb/ part is no needed 😉
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?
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*/
}
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
// 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); }
Copy link to clipboard
Copied
So was that problem with Russian version of Photoshop?
Copy link to clipboard
Copied
Whom and what exactly are you asking about?
Copy link to clipboard
Copied
One of you 😉 I'm asking as I can't reproduce this bug creating document & using this code.
Copy link to clipboard
Copied
Is your RGB channel (document layer) black?
P.S. Localization doesn't matter. I have English Photoshop if that.
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 🙂
Copy link to clipboard
Copied
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."
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.
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?
Copy link to clipboard
Copied
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?
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.
Copy link to clipboard
Copied
You are right. I tried it with grey layer and I see now without ApplyImage there was no selection.