PDA

View Full Version : OmniOutliner: Fastest way to set data in rows, columns or blocks?


nelsonm
2008-09-19, 09:28 AM
Any tips on the "fastest" way to put values into a document? I currently seem to have to loop through and insert values into one cell at a time like so:

(assume a 5 column document--three added to default)

tell application "OmniOutliner" to tell document 1
set theNewRow to make new row at end
repeat with i from 2 to 5
set the value of cell i of theNewRow to "foobar" & i
end repeat
end tell

My understanding is that you can speed things up by reducing the number of Apple Events so I figure that:

tell application "OmniOutliner" to tell document 1
set theNewRow to make new row at end
set the value of every cell of theNewRow to "foobar"
end tell

is probably faster, but I would also like to see a way to set each cell in the row (or column, or block) to a different value. Is there a way to do this? I'm using oo3.

Thanks in advance,
-N

RobTrew
2008-10-26, 07:01 AM
Use "with properties" statements.

See for example Omnifocus2Omnioutliner (http://web.mac.com/robinfrancistrew/Site/OF2Omnioutliner.html)

or, perhaps more helpfully,

OF2OPML (http://web.mac.com/robinfrancistrew/Site/OF2OPML.html)

which builds lists of properties before sending them to OmniOutliner.

Charles Turner
2009-07-26, 10:41 AM
Use "with properties" statements. See for example Omnifocus2Omnioutliner or, perhaps more helpfully, OF2OPML which builds lists of properties before sending them to OmniOutliner.

I looked at both these scripts briefly, and they only partially answer the OP's question. You can make a row and populate the "note" and "topic" cells at the same time, but as "column cells" seem to be elements, but not properties, of a row, it doesn't seem like you can populate anything beyond cell 2 using this technique.

So, is there any faster way?

Best, Charles

RobTrew
2009-07-27, 02:45 PM
it doesn't seem like you can populate anything beyond cell 2 using this technique

The columns which can be set through a property list when a row is created are indeed limited to three: State, Topic and Note.

Beyond that, and assuming that all references are fully cached, I would be inclined to test the hypothesis that list assignments extending the following patterns may be a little faster:

tell application "OmniOutliner Professional"
set oRow to item 1 of selected rows of front document
tell oRow
set {checked, topic, note} to {true, "new title", "new note"}
tell cells
set {value of item 3, value of item 4, value of item 5} to {"Surgery", "Thursday, June 11, 2009 00:00:54", "Wednesday, August 12, 2009 12:00:00"}
end tell
end tell
end tell