Copy link to clipboard
Copied
Here's the script by Peter Kahrel from the forums
I use this script to label specific characters on different columns with ABC.
The same file was available for use a year ago.
Now suddenly it prompts an error.
Some scripts will not work after ID upgrade?
Help to see it. Thank you very much.
Initial address:
cstyles = [
app.activeDocument.characterStyles.item('A'),
app.activeDocument.characterStyles.item('B'),
app.activeDocument.characterStyles.item('C'),
];
app.findGrepPreferences = null;
app.findGrepPreferences.appliedCharacterStyle
= app.activeDocument.characterStyles.item ('AAA');
instances = app.activeDocument.findGrep();
for (i = 0; i < instances.length; i++) {
columnIndex = instances[i].parentStory.insertionPoints.itemByRange (
instances[i].parentTextFrames[0].insertionPoints[0].index,
instances[i].index
).textColumns.length-1;
instances[i].appliedCharacterStyle = cstyles[columnIndex];
}