How do you insert ascending numbers and letters in table cells?
Found the following script on another discussion (http://forums.adobe.com/message/5574714#5574714) . . .
How can I alter it so it only adds numbers to one column, instead of every column?
What if I want the numbering to start in the 2nd or 3rd cell?
And is it possible to do this with the alphabet as well as numbers?
Thanks
//InsertNumbersInCellsColumnByColumn_SELECTION_TABLE.jsx
//Uwe Laubender
/**
* @@@BUILDINFO@@@ InsertNumbersInCellsColumnByColumn_SELECTION_TABLE.jsx !Version! Thu Nov 01 2012 07:39:54 GMT+0100
*/
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
app.doScript(_InsertNumbersInCellsColumnByColumn, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Insert numbers in cells column by column");
function _InsertNumbersInCellsColumnByColumn(){
var delimiter = "\t"; //Tab after the number: "\t"; if you want nothing just set its value to: "". If you want a blank change it to: " ";
var myTable = app.selection[0];
if(myTable.constructor.name !== "Table"){
alert("You have to select a Table. Script stops here.")
exit(0);
};
var counter = 0;
var tColumns = myTable.columns;
for(var n=0;n<tColumns.length;n++){
var myCellsPerColumn = tColumns.cells;
for(var c=0;c<myCellsPerColumn.length;c++){
counter = counter+1;
myCellsPerColumn.insertionPoints[0].contents = counter.toString()+delimiter;
};
};
alert("Done. "+counter+" cells were filled with numbers column by column.");
};
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
