Reply To: Help with editing script

#80087
Mike Dean
Member

Do you mean you want the very first character in the frame to use font[0] and swatch[0]? If that’s the case, you can adjust the for loop at the end of the script to start at the second character. Just change ch=0 to ch=1:
for (ch = 1; ch < app.selection[sel].characters.length; ch++) {

Then right above that loop, add a couple of lines to style the first character:
app.selection[sel].characters[0].appliedFont = font[0];
app.selection[sel].characters[0].fillColor = swatch[0];

And finally, to prevent the first font/swatch from being reused, you can add a couple of statements to remove them from the array:
font = font.slice(1);
swatch = swatch.slice(1);

Out of curiosity, what’s the utility of a script like this? I’m just having trouble thinking of how I would use this (other than to play an evil joke on someone… “what happened to all the text in your InDesign file??”).

This article was last modified on December 10, 2015

Comments (0)

Loading comments...