Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Need a stop block in my script

$
0
0

Hi Forum,,

 

I was very helpfull to learn from vamitul and Jarek previous thread help...

 

but still i'm lagging here and my mind blocked....

 

my script now find for the previous paragraph last character content ":" If yes, it will change all the bullets paragraphs first letter to caps...

 

what happening is, it convert all the first Letters in bullet paragraph to caps...

 

So now the stop block is needed to check, & stop changing the bullet first letter to uppercase if the previous paragraphs end character is not equal to ":"

 

 

var oDoc = app.activeDocument;

arr = [];

 

    var myNextPara = oDoc.textFrames.everyItem().getElements();

    for(k = 0; k<myNextPara.length; k++)  {

        myReturn = myNextPara[k].parentStory.paragraphs.firstItem(myNextPara[k].paragrap hs[0])

if(myReturn.isValid) {

    if(myReturn.bulletsAndNumberingListType !== ListType.BULLET_LIST &&

    myReturn.lines.lastItem().words.lastItem().characters.lastItem().cont ents == ":"&&

    myReturn.paragraphs.nextItem(myNextPara[k].paragraphs[0]).bulletsAndN umberingListType == ListType.BULLET_LIST)

 

{

changeCase();

}

if {myReturn.lines.lastItem().words.lastItem().characters.lastItem().con tents !== ":") {

exit

} } }

 

function changeCase() {

app.findGrepPreferences.bulletsAndNumberingListType = ListType.BULLET_LIST;

app.findGrepPreferences.findWhat = "^(\\l)";

 

finds = app.documents[0].findGrep();

for(i=0;i<finds.length;i++){

 

finds[i].contents=finds[i].contents[0].toUpperCase();

}}

 

Screen Shot 2013-08-22 at 14.14.44.png


Viewing all articles
Browse latest Browse all 15932

Trending Articles



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