Reply To: Removing End of Line Underlines

Home Page / Forums / General InDesign Topics (CLOSED) / Removing End of Line Underlines / Reply To: Removing End of Line Underlines

#51255

Choke my throat and call me a smurf. I tested the script, and I am so positive it worked yesterday! But something goes wrong right at the very start — I stated that 'it should create the style automatically if it doesn't exist yet', and, for sure, that's the part where it fails!

Here is a new, improved version. Better, stronger, faster … well, it works. (I double-checked this time Cool)

If you have a dedicated “Underline” character style as well, it makes removing this a bit easier. Just delete the style “NoUnderline” and replace with “Underline”. Then re-run the script, and it will re-create the style. (Honestly.)

//DESCRIPTION: Begone, Ugly End Of Line Underlining!

// (c) Jongware 16-Dec-2009

var blankStyle = app.activeDocument.characterStyles.item(“NoUnderline”);

try { blankStyle.index; } catch(_)

{

blankStyle = undefined;

}

if (blankStyle == undefined)

{

blankStyle = app.activeDocument.characterStyles.add();

blankStyle.name = “NoUnderline”;

blankStyle.underline = false;

}

for (a=0; a<app.selection[0].lines.length; a++)

{

if (app.selection[0].lines[a].characters.item(-1).contents == ” “)

app.selection[0].lines[a].characters.item(-1).appliedCharacterStyle = blankStyle;

}

This article was last modified on December 17, 2009

Comments (0)

Loading comments...