Add text if ParagraphStyle is found
Dear scripters,
Can you let Indesign to look for an specific paragraph style and if found than add an specific text before that line see picture below.
Before

After

Already thanks for you'r help.
Greetings.
Dear scripters,
Can you let Indesign to look for an specific paragraph style and if found than add an specific text before that line see picture below.
Before

After

Already thanks for you'r help.
Greetings.
Try the following code
function addTextToPara(pStyleName, prefixText)
{
app.findGrepPreferences.appliedParagraphStyle = pStyleName
var paraList = app.activeDocument.findGrep()
for(var i = 0 ; i < paraList.length; i++)
{
paraList.contents = prefixText + paraList.contents
}
app.findGrepPreferences = NothingEnum.nothing;
}
//Change the argument with the name of the paragraph style you want to search and the text you want to add before that para
addTextToPara("Paragraph Style 2", "<1>")
-Manan
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.