Quantcast
Channel: Adobe Community : All Content - InDesign Scripting
Viewing all articles
Browse latest Browse all 8771

reply try catch till right paragraph name

$
0
0

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


Viewing all articles
Browse latest Browse all 8771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>