Copy link to clipboard
Copied
Hi,
This is probably simple, but I can’t find how.
I need a snippet that will select and entire row from the location of the insertion of the cursor. Similar to the InDesign «Select Row» command.
Sorry for the newbie question.
Hi Jean-Claude
function selectRow(s) {
s = s || app.selection[0];
if (!s) {
return 'no selection';
}
while (s.constructor !== Cell){
s = s.parent;
if (s.constructor === Application) {
return 'no cell found';
}
}
s.parentRow.select();
}
selectRow();
HTH
Trevor
Copy link to clipboard
Copied
Hi Jean-Claude
function selectRow(s) {
s = s || app.selection[0];
if (!s) {
return 'no selection';
}
while (s.constructor !== Cell){
s = s.parent;
if (s.constructor === Application) {
return 'no cell found';
}
}
s.parentRow.select();
}
selectRow();
HTH
Trevor
Copy link to clipboard
Copied
Thanks Trevor... That did it!
Copy link to clipboard
Copied
Please @Trevor: Can this script modified to avoid selecting the header cell (in the same column)?
Thanks in Advance
Copy link to clipboard
Copied
To be clear, you want to select a column, not a row, but exclude header cells? If so, try this:
function selectColumn(s) {
s = s || app.selection[0];
if (!s) {
return 'no selection';
}
while (s.constructor !== Cell){
s = s.parent;
if (s.constructor === Application) {
return 'no cell found';
}
}
var target = s.parentColumn;
var pccells = target.cells;
for (var i = 0; i < pccells.length; i++) {
if (pccells[i].rowType !== RowTypes.HEADER_ROW) {
pccells[i].select();
}
}
}
selectColumn();
Copy link to clipboard
Copied
Thanks a lot @brian_p_dts
Copy link to clipboard
Copied
Please @brian_p_dts What is the Opposite Command of (Select()), i searched the DOM many times but didnt find anything, just deselect for item pages, but i mean deselect cells opposite of select();
Thanks
Copy link to clipboard
Copied
app.selection = null will remove all selections. The select() method has optional arguments that you can pass to it to replace the existing selection (default is to add to selection).
Copy link to clipboard
Copied
Thanks a lot @brian_p_dts