-
1. Re: Need a stop block in my script
Jump_Over Aug 22, 2013 9:37 AM (in response to indegn5)Hi,
Two things:
1. your way to go to changeGrep is really overcomplicated, but if you go there:
2. call changeGrep for found paragraph only, not for whole document (para.changeGrep()).
I would do it this way:
- findGrep with findWhat set to ":\\s*$" for whole doc ( doc.findGrep());
- iterate through and check if nextPara.bulletsAndNumberingListType = ListType.BULLET_LIST;
- if your condition is true ==> nextPara.words[0].characters[0].changecase(ChangecaseMode.UPPERCASE);
should be good enough
Jarek
-
2. Re: Need a stop block in my script
Jump_Over Aug 22, 2013 4:38 PM (in response to indegn5)Hi,
Code for above with small modification
(find Grep both paragraphs at once):
app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = ":\\s*\r."; // to match 2 paras - end & start var myDoc = app.activeDocument, mFound = myDoc.findGrep(), len = mFound.length; while (len--) { currPara = mFound[len].paragraphs[0]; nextPara = mFound[len].paragraphs[1]; if (nextPara.bulletsAndNumberingListType == ListType.BULLET_LIST && currPara.bulletsAndNumberingListType != ListType.BULLET_LIST) nextPara.words[0].characters[0].changecase(ChangecaseMode.UPPERCASE); } app.findGrepPreferences = app.changeGrepPreferences = null;Jarek
PS: if it keeps on rainin', levee's goin' to break
-
3. Re: Need a stop block in my script
indegn5 Aug 22, 2013 9:23 PM (in response to Jump_Over)HI Jarek!!!
Many many thanks..
Well, now it check and apply for the first two paragraphs only, how about for the following lines after paragraphs[1], till the paragraph [0] again start....
":\\s*\r.";thanks for the support and smartest idea.....
-
4. Re: Need a stop block in my script
Jump_Over Aug 23, 2013 12:40 AM (in response to indegn5)Hi,
Let me ask you once more about a goal:
- it should find ":" at the end of "no bullets" para and change case of 1st letter of the next para if it is with "bullet", or
- it should find ":" at the end of "no bullets" para and change case of 1st letter of every next para with bullet, stopping this at the and of bullets paras.
Jarek
-
5. Re: Need a stop block in my script
indegn5 Aug 23, 2013 2:04 AM (in response to Jump_Over)Many many apologize for the confusions and many thanks for the patience in replying me......
& supporting me....
I do want to change the first character of every paragraphs which is bullets and numbering:ListType.BULLETS format, following the paragraph, which has ":" at the end.
and not to the bullets and numbering paragraphs following the paragraph which doesnt have ":" at the end....
- it should find ":" at the end of "no bullets" para and change case of 1st letter of every next para with bullet, stopping this at the and of bullets paras.
Many thanks Jarek,....
-
6. Re: Need a stop block in my script
Jump_Over Aug 23, 2013 4:02 AM (in response to indegn5)Hi,
so lets include a function paraStepper():
app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = ":\\s*\r."; // to match 2 paras - end & start var myDoc = app.activeDocument, mFound = myDoc.findGrep(), len = mFound.length, currPara; while (len--) { currPara = mFound[len].paragraphs[0]; if (currPara.bulletsAndNumberingListType != ListType.BULLET_LIST){ currPara = paraStepper(currPara); while (currPara) { currPara.words[0].characters[0].changecase(ChangecaseMode.UPPERCASE); currPara = paraStepper(currPara); } } } function paraStepper (para){ var mRes = false, story = para.parentStory, next = story.paragraphs.nextItem(para); if (next.isValid && next.bulletsAndNumberingListType == ListType.BULLET_LIST) mRes = next; return mRes; } app.findGrepPreferences = app.changeGrepPreferences = null;Jarek
-
7. Re: Need a stop block in my script
indegn5 Aug 23, 2013 4:35 AM (in response to Jump_Over)I'm feeling too guilty to steal all your hardworks.... however, i feel so proud in learing something that is not in my mind <==> FROM YOU...
A bare mind of mine.. breaking my skull, to clear the clay blocks of all the veins, in my brain,... and to store a wonderfull ideas of yours....
Great & I'll give a treat for this treat....
Many thanks Jarek!!!!.



