Need a stop block in my script


hi forum,,

 

i helpfull learn vamitul , jarek previous thread help...

 

but still i'm lagging here , mind blocked....

 

my script find previous paragraph last character content ":" if yes, change bullets paragraphs first letter caps...

 

what happening is, convert first letters in bullet paragraph caps...

 

so stop block needed check, & stop changing bullet first letter uppercase if previous paragraphs end character not equal ":"

 

 

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].paragraphs[0])

if(myreturn.isvalid) {

    if(myreturn.bulletsandnumberinglisttype !== listtype.bullet_list &&

    myreturn.lines.lastitem().words.lastitem().characters.lastitem().contents == ":"&&

    myreturn.paragraphs.nextitem(mynextpara[k].paragraphs[0]).bulletsandnumberinglisttype == listtype.bullet_list)

 

{

changecase();

}

if {myreturn.lines.lastitem().words.lastitem().characters.lastitem().contents !== ":") {

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 @ 14.14.44.png

hi,

 

two things:

1. way go changegrep overcomplicated, if go there:

2. call changegrep found paragraph only, not whole document (para.changegrep()).

 

i way:

- findgrep findwhat set ":\\s*$" whole doc ( doc.findgrep());

- iterate through , check if nextpara.bulletsandnumberinglisttype = listtype.bullet_list;

- if condition true ==> nextpara.words[0].characters[0].changecase(changecasemode.uppercase);

 

should enough

 

jarek



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Thread: gpg: Conflicting Commands

Adobe Acrobat Pro , Terminal Server Use

when i try using AE CC 3d camera tracker after the first step it says "Analysis solve failed." help?