Copy link to clipboard
Copied
Hi,
I'm wondering if there's a way (or a script out there) to automate finding the last item of a bulletted list and apply a paragraph style? I'm dealing with multiple, hundred-page documents with tons of bulletted lists, and currently I'm applying a paragraph style to each of these in order to increase the space below the list and the top of the next paragraph.
Suggestions?
It’s not clear to me, if the bullets are formatted at this time or how you indentify them.
But try the following:
...app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.properties = { bulletsAndNumberingListType: ListType.BULLET_LIST };
var allFounds = app.findGrep();
for ( var i = 0; i < allFounds.length; i++ ) {
var curFound = allFounds;
var allParas = curFound.paragraphs;
var nParas = allParas.length;
allParas[nParas-1].appliedParagraphStyle = "
Copy link to clipboard
Copied
@Kai – Saving or resetting settings can be done by:
1. Write a log file and read a log file. The log file could be stored in the same folder where the script resides.
2. Use the insertLabel() method to write settings and extractLabel() method to read settings.
You have only to decide on the object you want to tag the key- and value-pairs.
2.1 App would be a candidate
2.2 Document could be a candidate (depending on the scope)
3. A combination of method 1 and method 2
3.1 Write key- and value-pairs e.g. to an added rectangle with insertLabel()
3.2 Export that rectangle as IDMS file
3.3 Import that IDMS file and read out or write out the key- and value-pairs
4. Let the script file change itself. Marc Autret once did a write up on this.
Indiscripts :: Can InDesign Script Rewrite Itself?
Uwe
Copy link to clipboard
Copied
Kai Rübsamen wrote:
I thought about the scope before I posted the lines.
Ouch -- Do Not Use with more than one document open! Currently, the line
var allFounds = app.findGrep(true);
searches in *all* opened documents by default ...
On the plus side: I like the dialog. I didn't test the script exhaustively (for the reason above) but it appears to work just as good under CS4.
Copy link to clipboard
Copied
Hi Guys,
thanks for your comments. So I will defenitly do something about the scope. This saving settings thing sounds to complicated for me at the moment.
I will post a new version, if I can figure out, what is the best way of offer a choice for the scope (surely another dropdown).
– Kai
P.S. This is my first script with more than 80 lines 😉
Copy link to clipboard
Copied
Kai Rübsamen wrote:
.. P.S. This is my first script with more than 80 lines 😉
Congrats on breaking a Personal Record! (My own largest script surely must be IndyFont, the demo alone is about 6,500 lines long -- I dare not speculate how much Marc added after that, with his many improvements and fully customized interface).
I think saving these settings application-wide may not be the best choice (after all, each document may have its own set of styles), but to save settings inside one document I used something like this:
if (app.activeDocument.label.match (/^JW:Cover/) == null)
return null;
lines = app.activeDocument.label.split('\n');
for (i=0; i<lines.length; i++)
{
if (lines.match(/^back=/))
back_type = lines.substr(lines.indexOf('=')+1);
.. etc. for each saved varaible
}
A Label may not be the best choice, some other options have been discussed as well elsewhere in this forum.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now