Another AppleScript question
Timothy J.Wood
tjw at omnigroup.com
Thu Dec 2 16:09:50 PST 2004
This works for me:
tell application "OmniOutliner Professional"
set MyParent to first child of front document whose topic is "BBBBBB"
make new row at end of children of MyParent
end tell
note that this inserts a blank row (which you could modify afterwards
obviously). If you know the topic you want to put in (or any other
properties) you could do:
make new row with properties {topic:"hi there!"} at end of children of
MyParent
There is one *important* issue here in the first line of the script
where it says "child of front document". The term "child" means that
you are looking for the first top level item of the document while you
might have said "row", in which case all the rows of the document would
be scanned. Both are equally valid, but differing operations.
-tim
On Tuesday, November 30, 2004, at 10:02 AM, Jan Erik Moström wrote:
> I'm making some attempts to make a few scriptsfor helping me keeping
> track of
> some software development notes, and to do that I would like to be
> able add a
> new row as a sub-item to a top level item. In other words, if I have
> this
> outline
>
> AAAAAA
> aaaaa
> aaaaa
> aaaaa
> BBBBBB
> bbbbb
> bbbbb
> bbbbb
> CCCCCC
> ccccc
> ccccc
> ccccc
>
> If I now want to add a sub item to the "BBBBB" item, how do I do that?
>
> In other words how do I write
>
> make new child to item "BBBBB"
>
> I could of course loop over all items to find "BBBBB" and do something
> like
> this
>
> tell application "OmniOutliner Professional"
> tell document 1
> set tli to the count of child
> repeat with i from 1 to tli
> if topic of child i = "BBBBB" then
> make new child after row (row of child i)
> return
> end if
> end repeat
> end tell
> end tell
>
> But I suspect there is a better way of doing this and most importent
> of all
> "make new child after row (row of child i)" doesn't work at all.
>
> What is the best way of doing this?
>
> jem
> --
> Jan Erik Moström www.mostrom.pp.se
> _______________________________________________
> OmniOutliner-Users mailing list
> OmniOutliner-Users at omnigroup.com
> http://www.omnigroup.com/mailman/listinfo/omnioutliner-users
>
More information about the OmniOutliner-Users
mailing list