-
1. Re: Apply new settings (from Justification panel) to all text of existing doc - CS3 ?
[Jongware] Jun 11, 2010 7:31 AM (in response to Tom Usrey)Well, you are halfway there!
You are correct: your sample "finds" everything with Times New Roman applied, then changes the stuff it has found. That's because the findText routine returns an array of 'Text' (in the InDesign sense; it comes with formatting and all).
The common object you were looking for is "Story" -- each and every text in your entire document has its own Story.
foundItems = app.activeDocument.stories; for (i=0; i<foundItems.length; i++) { foundItems[i].minimumWordSpacing = 70; foundItems[i].desiredWordSpacing = 90; foundItems[i].maximumWordSpacing = 110; } -
2. Re: Apply new settings (from Justification panel) to all text of existing doc - CS3 ?
[Jongware] Jun 11, 2010 8:04 AM (in response to [Jongware])Ahh -- I was just typing in a long story but was rudely interrupted by a client :-P
The story was about ... Stories! Since you want to change *every* text -- and that's equal to every *story* -- you can use a handy shortcut. "Stories" is a proper InDesign collection, which is a sort of array, but supports a few more properties than your own common variety (such as the ones you make yourself, and I think the ones returned by findGrep and simply using app.activeDocument.stories[x] as well).
Other scripters are more into the zone on this subject, and are invited to freely comment on my layman's explanation ...
In short, it means several important objects come with functions like "firstItem", "previousItem", "nextItem", and, yes! "everyItem". I always have to try before I know this will work under certain circumstances. Lo and behold: for your purposes, this appears to work just fine:
app.activeDocument.stories.everyItem().minimumWordSpacing = 70;
app.activeDocument.stories.everyItem().desiredWordSpacing = 90;
app.activeDocument.stories.everyItem().maximumWordSpacing = 110; -
3. Re: Apply new settings (from Justification panel) to all text of existing doc - CS3 ?
Tom Usrey Jun 11, 2010 8:26 AM (in response to [Jongware])Many thanks for taking the time to answer my post. I tried both your scripts and both do exactly what we needed. If you're ever in Dallas, I owe you some "huevos rancheros" and a margarita.


