Specs: Indesign CC 2015, Win10
Problem: In a large doc we’re working on, we have stories/text frames with text that comes with double hard carriage returns (empty paragraph/lines) to separate the story into chunks of lines. The paragraph style uses bullets and so the story has bullets followed by text and bullets with no text following… kind of like this: (and each story ends with two carriage returns)
> some text blah blah
> some text blah blah
>
> some some more text blah blah…
>
>
Desired Outcome: Visibly remove the bullet points from only empty lines.
Caveats before someone chimes in with… “remove hard carriage returns using GREP, Find/Change or script…
1. This text is coming from out-of-doc data source that Must include the hard returns. But the data overall is dynamic and changes periodically and so we update our doc’s text with this data containing these hard returns. So any local removing of the hard returns, changing them to soft returns, etc is pointless because as soon as we run an update, they’re back…with a bullet point.
2. I do have a GREP code that I can use in a Find/Change that finds every empty paragraph line in a story and I can go through the doc and Find Next and Change the bullet points away… For some reason, Change All does not do them all in one shot. As you might imagine this is tedious and not the efficient, one button way we would prefer.
3. It’s my understanding that Paragraphs Styles > GREP Styles can’t address this problem because those use only Character Styles to make changes and a character style cannot address my bullets… ? (I wish it could, because then I wouldn’t be here trying to explain this problem…but if anyone has a solution in this vein, please let me know!)
Possible solution?
I believe this is where we need a script. So far, I’ve found online discussion of code that uses lines like this, app.findGrepPreferences.findWhat… etc.
I’ve even worked up a script with parts that seem to work, but not all. Such as
app.findGrepPreferences = app.changeGrepPreferences=null;
app.findGrepPreferences.findWhat = “(?<=~b)$”;
app.findGrepPreferences.appliedParagraphStyle = “Fineline Description”;
And I can even see something being captured by using this:
var myFinelineDescriptionParas = app.activeDocument.findGrep();
alert (myFinelineDescriptionParas); // gives a list of all the empty paragraphs with said paragraph style for the whole doc
But when I add the rest of what I’ve seen suggested… like this: Nothing happens. Nothing changes.
app.changeGrepPreferences.appliedParagraphStyle = “Fineline Description – No Bullet”;
app.activeDocument.changeGrep();
Obviously I’m missing something or not going about it correctly in the script. Do I need to loop through the doc? Reference, gather (via var…=) more things from the DOM?
I appreciate any suggestions or questions if you need clarification.
Thanks