• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Help with an emergency: The script went wrong at a critical time.

Advocate ,
Dec 17, 2024 Dec 17, 2024

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:

https://community.adobe.com/t5/indesign-discussions/what-is-the-method-to-identify-which-column-a-ce... 

696.jpg

 

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];
}

 

 

TOPICS
Bug , Experiment , Feature request , How to , Performance , Scripting

Views

46

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines