Reply To: Changing the paragraph style of the NEXT paragraph using Find or GREP

Home Page / Forums / General InDesign Topics (CLOSED) / Changing the paragraph style of the NEXT paragraph using Find or GREP / Reply To: Changing the paragraph style of the NEXT paragraph using Find or GREP

#116306

The prettifying software of this forum automatically changed straight single and double quotes to “correct” curly opening and closing. And JavaScript cannot handle that! There is a minimal hint to this if you copied the code into Adobe’s own ExtendScript Toolkit Editor, or another code editor that does syntax-coloring: you can see text strings get a different color when you use the ‘correct’ type of quotes.

Trying again below; if it doesn’t work, delete the quotes one by one and replace them with *correct* correct straight ones.

app.findTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = "H2";
var myResults = app.activeDocument.findText();
for (i=0; i<myResults.length; i++)
	myResults[i].parentStory.paragraphs.nextItem(myResults[i].paragraphs[0]).appliedParagraphStyle = "No Indent Body"; 

This article was last modified on May 1, 2019

Comments (0)

Loading comments...