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:
Any help would be greatly appreciated!
Best, Peter
Copy link to clipboard
Copied
myF needs to be myF[i]
Iterators were stripped in old forum migration
Copy link to clipboard
Copied
Did you try putting that old script in a subfolder (under the Scripts folder) named "Version 9.0 Scripts"?
Copy link to clipboard
Copied
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