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

Determine if text layers need updating

Engaged ,
Nov 27, 2024 Nov 27, 2024

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??

 

 

GhoulFool_0-1732715152763.png

(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.

 

TOPICS
Actions and scripting
605
Translate
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 , Nov 28, 2024 Nov 28, 2024

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);
Translate
Adobe
Community Expert ,
Nov 27, 2024 Nov 27, 2024

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

 

Translate
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
Engaged ,
Nov 28, 2024 Nov 28, 2024

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.

 

GhoulFool_0-1732790737214.png

 

 

 

 

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.

 

Translate
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 Expert ,
Nov 28, 2024 Nov 28, 2024

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? 

Translate
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
Engaged ,
Nov 28, 2024 Nov 28, 2024

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.

 

Translate
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 Expert ,
Nov 28, 2024 Nov 28, 2024

I have test-files on hand with missing fonts, but none with update-necessary fonts. 

Can you provide one? 

Translate
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
Engaged ,
Dec 02, 2024 Dec 02, 2024

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.

Translate
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 ,
Nov 28, 2024 Nov 28, 2024

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);
Translate
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
Engaged ,
Dec 02, 2024 Dec 02, 2024
LATEST

r-bin That's got it!

Translate
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