I found the following promising script by Jon S. Winters,

function holdDescenders ( aTextFrame_o , extraHeight_n ) {
 //-- H O L D D E S C E N D E R S
 //-- Generic: Yes.
 //-- Purpose: To increase the height of the passed frame by the amount
 //-- that Adobe InDesign indicates is the height of the largest
 //-- descender of the frame.
 //-- Assumptions: 2
 //-- 1: This function assumes that the frame has already been collapsed
 //--  to the baseline of the last line of text as if you had used
 //--  its 'Fit Frame to Contents' function. Call this function
 //--  _after_ collapseing the frame using your desired method.
 //-- 2: The measurement system is assumed to be points.
 //-- Warning: There is no error checking for text that is not visible.
 //-- Parameters: 2
 //-- aTextFrame_o: A single text frame object. The frame whose height
 //--  you want to increase the height of by adding the maximum
 //--  descender height.
 //-- extraHeight_n: a point value. If not supplied, zero is assumed.
 //-- Returns: Nothing. The passed object is modified.
 //-- Written by Jon S. Winters on 2008.10.29
 //-- eps@electronicpublishingsupport.com
 //-- Verify argument 2. If it isn't a number, make it zero.
 extraHeight_n = parseFloat ( extraHeight_n ) ;
 if ( isNaN ( extraHeight_n ) ) { extraHeight_n = 0 } ;
 //-- Get the descender value
 var descenderHeight = aTextFrame_o.parentStory.characters[-1].descent ;
 //-- Increase the frame height
 var currentBounds = aTextFrame_o.geometricBounds ;
 currentBounds[2] = currentBounds[2] + descenderHeight + extraHeight_n ;
 aTextFrame_o.geometricBounds = currentBounds ;

(Source: http://extendscript.blogspot.com/2009/09/collapse-indesign-text-frame-to.html)

copied it as holdDescenders.js (I have also tried to change the extension to jsx) to the script directory (on Windows, it is %AppData%\Adobe\InDesign\Version 8.0\en_US\Scripts\Scripts Panel), and now I'm trying to run it in InDesign in different ways, but nothing happens.

Is it an error on my side or the script should be changed somehow so that it will work? I use InDesign CS6.

  • It's a 2008 script... I believe InDesign CS6 was released in 2012. To the best of my recollection InDesign (including CS6) simply requires one to dbl-click a text frame to extend it to the last line. This is an X/Y problem ... trying to correct the script may not correct whatever issue made you start searching for such a script. – Scott May 7 at 6:39
  • 1
    This is not a whole script, this is simply a function that could be made part of a larger script. As it currently stands, the code that you have is perfectly unaware of any selections you made or any text frames that are in the document, so it is not wonder nothing happens. To make it work, you would need to embed it in a script that handles your selection and such. – mdomino May 7 at 7:12
  • @mdomino In case it is not very time-consuming, could you show how to convert it to a working script or provide a link to a good article on this topic? – john c. j. May 7 at 10:52
  • @Scott, I prefer Ctrl+Alt+C instead, but either way doesn't hold descenders. Holding descenders, like the lower part of "j", is the whole point of what I need – john c. j. May 7 at 10:52
  • 1
    This is of course possible, but could you perhaps expand a little on why you need this? Since it's not easily achievable it's not something people normally need. There might be another and easier way to achieve what you want. – Wolff May 7 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.