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

Indesign script for Paragraph Style to Tables

Community Beginner ,
Jun 11, 2024 Jun 11, 2024

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
440
Translate
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

myF needs to be myF[i]

 

Iterators were stripped in old forum migration

Translate
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

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

Mike Witherell
Translate
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
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

Translate
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