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();
}}
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
Post a Comment