Question
How to modify this script to target the current textbox or selection
This script fills empty cells of a table with a certain character (e.g. -).
It now affects the entire document.
Would anyone like to help modify it by adding the options: whole document, current article, current selection?
Thanks a lot.
var myDocument = app.documents.item(0);
var myStory = myDocument.stories;
for (var s=0; s<myStory.length;s++){
var myTable = myStory.item(s).tables;
for (var t=0; t<myTable.length;t++)
for (var i=0; i<myTable[t].columns.length; i++){
for (var j=0; j<myTable[t].columns.item(i).cells.length; j++){
if (myTable[t].columns.item(i).cells.item(j).contents == ""){
myTable[t].columns.item(i).cells.item(j).contents ="—"; //The character you want to fill
}
}
}
}
