How to select a non-topic cell

How do you specific which column to get a cell from?

For example, this works:
set cell3Value to value of cell 3 of currentRow

But this doesn’t work:
set cell3Value to value of cell “My thoughts” of currentRow

where “My Thoughts” is the third column…

Thanks!

What you think is the third column probably isn’t the third column. There is an ‘invisible’, or non-text column on the left hand side of a standard document.

If you create a basic blank document (which has only the ‘Topic’ column to type in) and then add two columns to the left of it, your three regular columns will be titled as follows: Topic, Column 2, Column 3.

To get the text in Column 3, use something like this…

	text of cell 4 of child 1 of document 1

Note that even though your document has but three columns, you use cell 4 to work with the third column. Cell 1 would refer to your notes. If you don’t have any for that row, you’ll get a “”. If you click along the column title headers, you’ll see that there is that first column to the left of the topic.

My thoughts is the column name, but not the name of the cell you’re after.

You can replace ‘child 1’ with ‘selected row’ or whatever.
You can replace ‘text’ with ‘value’ as you see fit.

Hope this helps.

Thanks for the note. Is there a way to specific which cell, without counting the number of columns? That way I can have different numbers of columns, as long as my column titles are the same in varied OO documents.

I don’t think that there is a direct way to do so, but you can query the document to give you a column number. Basically, you make a list from the column names and then see where in the list your column is. There are probably multiple ways of doing so but the ‘set colList’ line will get the names of each of your columns.

tell application "OmniOutliner"
	
	set colList to name of columns of document 1
	set wantCol to "focal"
	
	repeat with i from 1 to the count of colList
		if item i of colList is wantCol then return i
	end repeat
end tell