Applescript newbie
Michael Terry
formido at mac.com
Tue Jan 13 18:03:17 PST 2004
On Jan 13, 2004, at 4:19 PM, Richard Sandilands wrote:
> A simple applescript question.
>
> I simply want to move rows whose status is checked to be children of a
> row whose topic is "Completed".
>
> Assume the row with topic "Completed" is in existence already and is at
> the same level as the checked items (prior to their being moved).
>
tell application "OmniOutliner" to tell front document
set doneRow to first row whose topic is "Completed"
set doneRowLevel to level of doneRow
move (every row whose state is checked and level is doneRowLevel and
topic is not "Completed") to end of doneRow
end tell
This will do it, with one caveat: The "Completed" row needs to be the
last row of the document[1]. The above is the only efficient way of
doing it, although efficiency might not much matter depending on
exactly how your document evolves. The other alternative would be a
repeat loop instead of the filter clauses (every row whose blah). Then
things could be more flexible, but would be a lot slower. Note that
there are only 5 lines in the script, so if you see more than that,
some vagary of e-mail mucked with it so you'll have to put things
right.
Cheers,
Mike
[1] Note to OmniGroup: In my opinion, this script should work even if
the "Completed" row is, for example, in the first row in the document.
More information about the OmniOutliner-Users
mailing list