Skip to content

Instantly share code, notes, and snippets.

@AlexeyNik
Created October 24, 2018 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexeyNik/a1a9feac6ba2f4ace8efc2a6cd79b4b4 to your computer and use it in GitHub Desktop.
Save AlexeyNik/a1a9feac6ba2f4ace8efc2a6cd79b4b4 to your computer and use it in GitHub Desktop.
function addTextToPara(pStyleName, prefixText)
{
app.findGrepPreferences.appliedParagraphStyle = pStyleName
var paraList = app.activeDocument.findGrep()
for(var i = 0 ; i < paraList.length; i++)
{
paraList[i].contents = prefixText + paraList[i].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>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment