Format Script
Hi all, is there or does anyone know a script that allows me to assign a predefined cell and character format to every 4th row in a table?
A script recording like in Photoshop does not exist in InDesign, right?
Thanks, Dietmar
Hi all, is there or does anyone know a script that allows me to assign a predefined cell and character format to every 4th row in a table?
A script recording like in Photoshop does not exist in InDesign, right?
Thanks, Dietmar
Also, here's another approach: to get the table based on its Script Label. First select your whole table (click in a cell, then choose menu Table > Select > Table) and show the Script Label panel (choose menu Windows > Utility > Script Label) and type the label you want (name it similar to the way you would name a variable I guess, eg. "myTable").
- Mark
var table = getTableByLabel(app.activeDocument, 'myTable');
/**
* Returns a table with matching script label.
* @7111211 m1b
* @version 2022-08-15
* @9397041 {Document} doc - an Indesign Document.
* @9397041 {String} findLabel - the label to search for.
* @Returns {Table}
*/
function getTableByLabel(doc, findLabel) {
if (
doc == undefined
|| !doc.isValid
|| doc.stories.everyItem().tables.length == 0
)
return;
var tables = doc.stories.everyItem().tables.everyItem().getElements();
for (var i = 0; i < tables.length; i++) {
try {
if (
tables[i] != undefined
&& tables[i].isValid
&& tables[i].label == findLabel
)
return tables[i];
}
catch (error) {
$.writeln('Invalid Table: "' + doc.stories.everyItem().tables.item(i).toSpecifier() + '"');
}
}
};
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.