Copy link to clipboard
Copied
Ignoring the "some text layers might need to be updated..." message ...
Is there a scriptable way of determining if said text layer has the triangle warning icon??
(text layer needs updating warning icon)
Kinda like this:
if (theLayer.kind == "LayerKind.TEXT")
{
if (theLayer.textItem.feelingABitSleepyAndNeedsToBeUpdated == true)
{
theLayer.textItem.refresh();
}
}
Assuming this is only caused by old file created in prevouos versions of Photoshop.
1 Correct answer
Try this
var id = activeDocument.activeLayer.id;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("textWarningLevel"));
r.putIdentifier(stringIDToTypeID("layer"), id);
var ret = executeActionGet(r).getInteger(stringIDToTypeID("textWarningLevel"));
alert("Warn = " + ret);
Explore related tutorials & articles
Copy link to clipboard
Copied
If this is about missing fonts you could adapt this Script, otherwise yould you please provide an affected file?
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
//
main ();
};
////////////////////////////////////
function main () {
var theFonts = new Array;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
//////
for (var m = theNumber; m >= 0; m--) {
try {
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), m);
var layerDesc = executeActionGet(ref);
var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
var theName = layerDesc.getString(stringIDToTypeID('name'));
// if not layer group collect values;
if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && isBackground != true) {
var hasText = layerDesc.hasKey(stringIDToTypeID("textKey"));
if (hasText == true) {
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
var paragraphRangeList = textDesc.getList(stringIDToTypeID('paragraphStyleRange'));
var kernRange = textDesc.getList(stringIDToTypeID('kerningRange'));
var rangeList = textDesc.getList(stringIDToTypeID('textStyleRange'));
for (var o = 0; o < rangeList.count; o++) {
var styleDesc = rangeList.getObjectValue(o).getObjectValue(stringIDToTypeID('textStyle'));
// check for default font;
if (styleDesc.hasKey(stringIDToTypeID('fontPostScriptName')) == true) {
var available = styleDesc.getBoolean(stringIDToTypeID("fontAvailable"));
//checkDesc2(styleDesc);
var aFont = [styleDesc.getString(stringIDToTypeID('fontPostScriptName')), available]}
else {
var theDefault = styleDesc.getObjectValue(stringIDToTypeID('baseParentStyle'));
var available = styleDesc.getBoolean(stringIDToTypeID("fontAvailable"));
var aFont = [theDefault.getString(stringIDToTypeID('fontPostScriptName')), available];
};
// add to array;
var theCheck = true;
for (var n = 0; n < theFonts.length; n++) {
if (theFonts[n] == aFont) {theCheck = false}
};
if (theCheck == true) {theFonts.push(aFont)}
}
}
}
}
catch (e) {};
}
alert ("the result:"+"\n"+theFonts.join("\n"))
};
Copy link to clipboard
Copied
Thanks for that.
Sadly that works for font's that are missing, which is different to fonts that are avaiable - but somehow need to be updated.
Most of the time it'll just update the file and save it and there is no real difference.
However...
if you are working on a typeface which is in the PSD and want to see any changes at the old/new iteration it's best to go over the whole file layer by layer - hence looking to a script.
As it seems double clicking the text layer to update it, will also save the file (without asking) Bad Photoshop, no biscuit.
Copy link to clipboard
Copied
You should be able to adapt the Script – instead of collecting an array of fontnames just selecting the Layer the first time it hits a missing font?
Or how would you want to have the thing work?
Copy link to clipboard
Copied
That's the thing. the font isn't missing. It needs "updating".
Had a look at two files using Beyond Compare and the comparrison is more comples than I though. Visually it's very subtle differences to the outline (fonder rendering differnce between versions?) and quite a lot of bytes in hex.
Copy link to clipboard
Copied
I have test-files on hand with missing fonts, but none with update-necessary fonts.
Can you provide one?
Copy link to clipboard
Copied
We'll get back to you on that one. The test .psd file I have (with a visible warning icon in the text layers) dissapears on on a reboot.
Copy link to clipboard
Copied
Try this
var id = activeDocument.activeLayer.id;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("textWarningLevel"));
r.putIdentifier(stringIDToTypeID("layer"), id);
var ret = executeActionGet(r).getInteger(stringIDToTypeID("textWarningLevel"));
alert("Warn = " + ret);
Copy link to clipboard
Copied
r-bin That's got it!

