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

#54277

Yes, that's annoying. ID cannot find/change something based on soft line endings, so a Javascript would come in handy. (Audience: “Javascript?”) Sure, no problem. Copy and paste the following one into a plain text editor (Notepad, TextEdit in plain text mode; best is Adobe's own ESTK editor that comes installed with InDesign) and save into your User Scripts folder as “NoUnderline.jsx”. Select an appropriate amount of text, and run the script. It will add a character style to underlined spaces at the end of each line, and leave other end characters (such as soft hyphens) alone. If your text changes and you want the underlines back, do the following:

1. Edit the character style “NoUnderline”; set Underlining on.

2. Delete the character style; select “Preserve Formatting”.

3. Run the script again on your selection of text.

Alternatively, select a run of text and remove the character style by replacing it with “[None]” and restore Underline in the Change Formatting box.

Here's the script:

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

// (c) Jongware 16-Dec-2009


try {

blankStyle = app.activeDocument.characterStyles.item("NoUnderline");

} catch (_)

{

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 16, 2009

Comments (0)

Loading comments...