Copy link to clipboard
Copied
I'm doing some maneuvering through tables, and running into a bit of a conundrum using the cells.itemByName("colIndex:rowIndex") matrix to select my preferred cell.
var cell_ref = '"' + new_column.toString() + ":" + new_row.toString() + '"';
$.writeln(cell_ref); //returns "2:3"
THE_TABLE_OBJECT.cells.itemByName(cell_ref).select(); //selects column 0, row 3
Very odd behavior. I am able to work around with:
THE_TABLE_OBJECT.rows[new_row].cells[new_column].select();
If I test on the same table with just a one-line code of:
THE_TABLE_OBJECT.cells.itemByName("2:3").select();
it works fine.
Could it have something to do with how converting new_column.toString() is behaving? It shows as "2:3" in the console, but maybe something fishy is going on there? I've tested the new_column integer and it shows as 2 with a Number constructor.
Anyone else have any experience with this bug? Not a huge deal I suppose since there's a workaround; just curious.
Hi brianp311,
Why are you putting those double quotation marks?
Instead you can try like this :
///////////////////////////////////////////////////
var cell_ref = new_column + ":" + new_row;
$.writeln(cell_ref);
app.documents[0].textFrames[0].tables[0].cells.itemByName(cell_ref).select();
///////////////////////////////////////////////////
Because Cells.itemByName(Argument)== This methods expects String (Digit:Digit) but in your code you are giving Double quotation as well and that is not a di
...Copy link to clipboard
Copied
Hi brianp311,
Why are you putting those double quotation marks?
Instead you can try like this :
///////////////////////////////////////////////////
var cell_ref = new_column + ":" + new_row;
$.writeln(cell_ref);
app.documents[0].textFrames[0].tables[0].cells.itemByName(cell_ref).select();
///////////////////////////////////////////////////
Because Cells.itemByName(Argument)== This methods expects String (Digit:Digit) but in your code you are giving Double quotation as well and that is not a digit that is the reason why column index is not working, but after color (:) there is a digit for row, so that one is working fine with index.
Best
Sunil
Copy link to clipboard
Copied
D'oh, of course. Long story short, converting someone else's Applescript to jsx and got lost in translation. Thanks Sunil.