Text is overset text?

Community Beginner ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

Hi Team,

 

Kindly let me know how to find text overset available in psd file using javascript/script listener.

 

Thanks

TOPICS
Actions and scripting

Views

1.0K

Likes

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 ,
May 19, 2021 May 19, 2021

Copy link to clipboard

Copied

Please elaborate. 

Likes

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 ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

Hi,

Kindly Review below snaps.

 

Screen Shot 2019-09-19 at 12.48.38.jpg

Some texts are hidden under the text item.

i need to write to automation scripts thats helps to shown overset documents names.

 

Thanks

Likes

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 ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

Thanks. 

 

I seem to recall past discussion/s on the issue though I couldn’t find the thread/s. 

 

If you cannot identify a property in the AM code checking the text, then converting to Point Type and checking if the text is unchanged (and undoing the conversion, naturally) would provide a work-around. 

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

The Strings of texts with more than one line cannot be identical because the line-breaks and the hyphens in the Point Text are letters, too, but by comparing letter for letter one can »filter« them out and determine if overset text exists. 

One could then do that with all type layers in a document. 

 

@Kukurykus , @r-bin , @jazz-y , please forgive the intrusion but at current you are the ones whose names come to my mind easily when it comes to Photoshop Scripting advice on this Forum; do any of you have a better idea or an immediate way of determining overset text in a Type Layer? 

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

I still don't understand what he wants 😉

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

I think he wants to determine (in bulk) which files contain Paragraph Type Text Layers with overset text (when the Type Layer's bounds are too smal to contain all the entered text). 

Screenshot 2021-05-23 at 14.05.56.pngScreenshot 2021-05-23 at 14.05.47.png

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

I got it. Probably the 2 others you mentioned will help more as I saw them in action with this.

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

Thank you! 

I had done a Forum search here but I didn’t find a solution, maybe I should have checked over on PS-Scripts

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

When from you're ACP? Months ago you weren't interested. What happened now you are?

Likes

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 ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

c.pfaffenbichler

I practically don't work with text. I know very little about it. You can try this way.

var y1 = activeDocument.activeLayer.bounds[3].value;
var h = activeDocument.activeLayer.textItem.height;

activeDocument.activeLayer.textItem.height = 2*h;

var y2 = activeDocument.activeLayer.bounds[3].value;

activeDocument.activeLayer.textItem.height = h;

alert(y2-y1)

 

If the result y2-y1 is zero, then with a high probability we can say that all the text is visible.

Likes

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 ,
May 24, 2021 May 24, 2021

Copy link to clipboard

Copied

LATEST

Thanks! 

 

I tried to follow up on the point text work-around. 

// check if type layers in active document have overset text;
// 2021, use it at your own risk;
if (app.documents.length > 0) {
    var theCheck = checkForOversetText ();
    alert ("layers with index "+theCheck.join(", ")+" contain overset text")
};
////// check for overset texts //////
function checkForOversetText () {
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
    var applicationDesc = executeActionGet(ref);
    var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
    var theArray = new Array;
// work through layers;
    for (var m = theNumber; m >= 0; m--) {
        try {
////////////////////////////////////
var someValues = someTextProperties(m);
if (someValues != false){
if (someValues[0] == "box"){
// convert to point type;
var desc01 = new ActionDescriptor();
var ref5 = new ActionReference();
ref5.putProperty( stringIDToTypeID( "property" ), stringIDToTypeID( "char" ) );
ref5.putIndex( stringIDToTypeID( "textLayer" ), m );
desc01.putReference( stringIDToTypeID( "null" ), ref5 );
desc01.putEnumerated( stringIDToTypeID( "to" ), stringIDToTypeID( "char" ), stringIDToTypeID( "paint" ) );
executeAction( stringIDToTypeID( "set" ), desc01, DialogModes.NO );
var otherValues = someTextProperties(m);
// undo;
activeDocument.activeHistoryState = activeDocument.historyStates[activeDocument.historyStates.length - 2];
// compare;
    var theCheck = true;
    var theNumber1 = 0;
    var theNumber2 = 0;
    while (theCheck == true && theNumber1 != someValues[1].length) {
        var value1 = someValues[1][theNumber1];
        var value2 = otherValues[1][theNumber2];
        if (value1 != value2) {
            switch (value2) {
                case "\r":
                    theNumber1++;
                    theNumber2++;
                    break;
                case "-":
                    theNumber2++;
                    theNumber2++;
                    break;
                default:
                    theCheck = false;
                    break;
                };
        } else {
        theNumber1++;
        theNumber2++
        }
    };
if (theCheck == false) {theArray.push(m)}
else {};
}
};
////////////////////////////////////
    }
    catch (e) {};
    };
// select layers;
if (theArray.length > 0) {
    selectLayerByIndex(theArray[0],false);
    for (var x = 1; x < theArray.length; x++) {
    selectLayerByIndex(theArray[x],true)
    }
};
// return results;
return theArray
};
////// check something //////
function someTextProperties (theIndex) {
    try {
        var ref = new ActionReference();
        ref.putProperty(stringIDToTypeID( "property" ), stringIDToTypeID('textKey'));
        ref.putIndex ( charIDToTypeID("Lyr "), theIndex);
        var layerDesc = executeActionGet(ref);
        var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
        var theText = textDesc.getString(stringIDToTypeID('textKey'));
        var textShape = textDesc.getList(stringIDToTypeID('textShape'));
        var paragraph = typeIDToStringID(textShape.getObjectValue(0).getEnumerationValue(stringIDToTypeID('char')));
        return [paragraph, theText]
    } catch (e) {return false}
};
// by mike hale, via paul riggott;
function selectLayerByIndex(index,add){ 
    add = undefined ? add = false:add 
    var ref = new ActionReference();
        ref.putIndex(charIDToTypeID("Lyr "), index);
        var desc = new ActionDescriptor();
        desc.putReference(charIDToTypeID("null"), ref );
           if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) ); 
          desc.putBoolean( charIDToTypeID( "MkVs" ), false ); 
       try{
        executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );
    }catch(e){
    alert(e.message); 
    }
    };

 

Likes

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