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

Indesign script for Paragraph Style to Tables

Community Beginner ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

Dear all,

 

I am trying to get the script to work that was posted here in 2013: https://community.adobe.com/t5/indesign-discussions/script-for-indesign-find-paragraph-style-change-...

 

So far, it does not work, as I suspect it is outdated. Can anyone help me get it to work on INDD 18.5.2? Basically I would like to convert all paragraph that have a certain paragraph style to tables, and apply a table style.

 

So far, I get this error:

 

pjgjpg_0-1718116353838.png

Any help would be greatly appreciated!

 

Best, Peter

TOPICS
Scripting

Views

127

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
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

myF needs to be myF[i]

 

Iterators were stripped in old forum migration

Votes

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
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

Did you try putting that old script in a subfolder (under the Scripts folder) named "Version 9.0 Scripts"?

Mike Witherell

Votes

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
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

LATEST

I think the script would execute fine on the current version of InDesign as well. Two things to change though

So the correct code would be

function main() {
          app.findTextPreferences = app.changeTextPreferences = null;
          app.findTextPreferences.appliedParagraphStyle = "name_of_your_style" //won't work it it's in a style group
          var myF = app.activeDocument.selection[0].parentStory.findText(true); //make sure you are inside a text frame when running the script
          for (var i = 0; i < myF.length; i++) {
                    var myT = myF[i].convertToTable();
                    myT.appliedTableStyle = "Name_of_your_Table_style";
                    myT.clearTableStyleOverrides(); //this line might need to be commented out, see how it works with or without it
          }
          alert("All done!\nYou can go outside and play now!");
}
app.doScript('main()', undefined, undefined, UndoModes.entireScript, 'AllToTables');

-Manan

Votes

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