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

#116293
Robert Kern
Member

Hi Theunis,

I tried your script but it kicked out the following error:

Error Number 8:
Error String: Syntax error

Line 5:
Source: app.findTestPreferences.appliedParagraphStyl,e = “H2″;
Offending Text: ”

I’m a newbie to scripting, users not a writer, but it seemed simple enough to modify our script to the tags we use (H1, H2, H3, and Body1).
Any thoughts on how to adjust the script, below, to fix the problem is greatly appreciated!

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 = “Body1”;

This article was last modified on April 30, 2019

Comments (0)

Loading comments...