Hi
I have a document with multiple columns and would like to remove all the content of certain rows.
Seems to be mission impossible without some scripting!
I think that more details would be necessary to help with this, including some sample data.
Nothing too complex see the document I created below from blank and populated two rows. I want to ‘empty’ all the ‘cells’ of row 1 (by row one I mean the one highlighted) or all the ‘cells’ except the first one, how can I achieve that?
I’ll use the following to demonstrate a few techniques:
At the top of the script, to get our bearings, we lay out of some of the rows and columns of the outline for the script. Note that the children in the example refers to the three level 1 rows of the document. There are also two ‘leaves’ of the first child; they can also be referred to as ‘children of child 1’.
tell application "OmniOutliner"
tell document 1
set ar to children -- of document
--> {child 1 of document id "nw0LCxugaEx" of application "OmniOutliner", child 2 of document id "nw0LCxugaEx" of application "OmniOutliner", child 3 of document id "nw0LCxugaEx" of application "OmniOutliner"}
-- assign a variable to a single row
set ar1 to child 1
-- assign a variable to a range of rows
set ar2 to a reference to children 2 thru -1
-- take a look at the column layout
name of column of cells of ar1
--> {"", "Topic", "Time", "Column 2", "Column 3", "Column 4"}
-- note that the first column is nameless; it refers to the narrow column at the left edge of the document window that typically contains the 'notes' icon when you hover over it;
-- change cell values
-- edit cells to the right of the topic cell
set value of cells 3 thru -1 of ar1 to ""
-- edit topic cell only
set value of cell 2 of ar1 to "new topic"
-- edit entire row
-- set value of cells 2 thru -1 of ar1 to "number"
-- edit cells of rest of top level rows
set value of cell 2 of ar2 to "other rows' topic"
set value of cells 3 thru -1 of ar2 to "other rows' value"
-- edit cells of leaves of first child
set value of cell 2 of leaves of ar1 to "leaf topic" -- affects all leaves of ar1
set value of cells 3 thru -1 of leaf 1 of ar1 to "leaf 1 values" -- affects first leaf of ar1
end tell
end tell
The end result after all that should look like this.
If you wish to clear the entire first row, including the topic cell, uncomment the ‘
set value of cells 2 thru -1 of ar1 to "number"
’ line in the script.