-
1. Re: Remove the line-ender but keep the note
RobertKyle Sep 21, 2012 3:10 PM (in response to RobertKyle)Having failed to attract the attention of any Great Scripting Minds, I plowed ahead on my own and came up with this:
var myParentStory = app.selection[0].parentStory;
//check top of story for paragraphs containing only notes
var myFirstGraf= myParentStory.paragraphs[0];
if (myFirstGraf.notes.length>0) {
while (myFirstGraf.length == myFirstGraf.notes.length + 1) {
myFirstGraf.characters.item(-1).remove(); // remove paragraph return
var myFirstGraf= myParentStory.paragraphs[0]; //reset variable to new first graf
} // end while
} // end if
Is it dangerous? Foolish? Verbose?
-
2. Re: Remove the line-ender but keep the note
Marc Autret Sep 21, 2012 4:31 PM (in response to RobertKyle)Hi Robert,
Here is an alternative approach—quite experimental!—which should deal the same way with all text markers (notes, index, etc.):
var m, t = myParentStory.texts; while( m=t[0].paragraphs[0].contents.match(/^(\uFEFF*)\r/) ) t[0].characters[m[1].length].remove();
Just for fun ;-)
@+
Marc



