Hi, I have to apply a paragraph style to grep preferences before a find cycle.
If user input is a paragraph name not existing in the document the script outputs an error.
First error rules right but second stops script. And, of course, I need to go ahead till right paragraph name.
here's javascript
app.findGrepPreferences = app.changeGrepPreferences = null;
var myPara = prompt ("input a paragraph style", "");
try {
app.activeDocument.paragraphStyles.itemByName(myPara).name;
alert ("This is a paragraph style!");
}
catch (myError) {
var myPara = prompt ("This is NOT a paragraph style! \rType existing style ", "")
}
app.findGrepPreferences.appliedParagraphStyle = myPara;
alert ("Correct! \nStyle applied in grep preferences!");
Any idea? ...maybe a while loop could resolve (tryied without success)
Thanks