The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   OmniOutliner: Fastest way to set data in rows, columns or blocks? (http://forums.omnigroup.com/showthread.php?t=9941)

nelsonm 2008-09-19 09:28 AM

OmniOutliner: Fastest way to set data in rows, columns or blocks?
 
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 [URL="http://web.mac.com/robinfrancistrew/Site/OF2Omnioutliner.html"]Omnifocus2Omnioutliner[/URL]

or, perhaps more helpfully,

[URL="http://web.mac.com/robinfrancistrew/Site/OF2OPML.html"]OF2OPML[/URL]

which builds lists of properties before sending them to OmniOutliner.

Charles Turner 2009-07-26 10:41 AM

[QUOTE]Use "with properties" statements. See for example Omnifocus2Omnioutliner or, perhaps more helpfully, OF2OPML which builds lists of properties before sending them to OmniOutliner.[/QUOTE]

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

[QUOTE=Charles Turner;63529]it doesn't seem like you can populate anything beyond cell 2 using this technique[/QUOTE]

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:

[CODE]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
[/CODE]


All times are GMT -8. The time now is 12:34 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.