Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


[Script] Get number of characters in overflow text or where text starts to overflow

Explorer ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Hi everybody,

I'm working on a script about text overflow in InDesign.
My purpose is to find how many characters are overflowing textFrame or where text starts to overflow (for each textFrame in document).

So far, I've found that textFrame object has a property called 

overflows (boolean)

which indicates if its text overflows. But I could not find more information in this object properties.

Then, I worked on preflight.
I try :

var doc = app.activeDocument;
var my_profile = app.preflightProfiles.firstItem();  
var my_process = app.preflightProcesses.add(app.activeDocument, my_profile);          
my_process.waitForProcess();          
var results = my_process.aggregatedResults;

And I get :

We can see that here, we have the information I want. But it depends on user's interface language in InDesign so I cannot properly use this solution.

 

My last lead is to find information used in that InDesign screen (editor mode) :

Sans titre.png

 

Can somebody help me to achieve my purpose please ?

Thanks in advance

Regards

TOPICS
How to, Scripting, SDK

Views

114

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

correct answers 1 Correct answer

Adobe Community Professional , May 26, 2021 May 26, 2021
Hi @emiliep89320758, With the textframe selected run the following code var tf = app.selection[0] var oversetContent = tf.parentStory.insertionPoints.itemByRange(tf.insertionPoints[-1].index, tf.parentStory.insertionPoints[-1].index).contents alert("Overset Content is \""+ oversetContent + "\" length " + oversetContent[0].length + " starts at index " + tf.insertionPoints[-1].index) -Manan

Likes

Translate

Translate
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

LATEST

Hi @emiliep89320758,

With the textframe selected run the following code

var tf = app.selection[0]
var oversetContent = tf.parentStory.insertionPoints.itemByRange(tf.insertionPoints[-1].index, tf.parentStory.insertionPoints[-1].index).contents
alert("Overset Content is \""+ oversetContent + "\" length " + oversetContent[0].length + " starts at index " + tf.insertionPoints[-1].index)

-Manan

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