Reply To: hanging indents on centered text

Home Page / Forums / General InDesign Topics (CLOSED) / hanging indents on centered text / Reply To: hanging indents on centered text

#14331837

I was wrong: I needed 7 code-lines!

(^/) The Jedi

/*
_FRIdNGE-0662_Justif-Center.jsx
Script written by FRIdNGE, Michel Allio [26/10/2020]
See: https://creativepro.com/topic/hanging-indents-on-centered-text/ [Flavio Mini, 21/10/2020]
Object: Left-indent calculated on para first line parameters. Not use a “tab” as delimiter but another space-type.
*/

app.doScript(“main()”, ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, “Justif-Center! …”);

function main()
{
var mySel = app.selection[0].paragraphs[0],
myLeft = mySel.lines[0].insertionPoints[0].horizontalOffset – app.selection[0].parentTextFrames[0].geometricBounds[1];
myRight = app.selection[0].parentTextFrames[0].geometricBounds[3] – mySel.lines[0].insertionPoints[-2].horizontalOffset;
mySel.justification = Justification.LEFT_ALIGN;
mySel.leftIndent = myLeft;
mySel.rightIndent = myRight;
mySel.firstLineIndent = -myLeft + myRight;
}

This article was last modified on October 26, 2020

Comments (0)

Loading comments...