I have had a look at the example script and have quoted part of it below along with my thoughts on what the code is doing. I would like to know if I am correct:
Code:
-- create the entry for today in the done document if it isn't already there
if not (exists (last child of doneDoc)) then
tell doneDoc
make new row at end of rows
end tell
end if
I think he children of a OO3 document are its top level rows, a new document has no rows so has no "last child". If I'm correct then this block is saying "add a new top level row to the new document"
Code:
set newRow to last child of doneDoc
if dateString is not equal to (topic of newRow) then
set newRow to make new row at end of rows of doneDoc
set topic of newRow to dateString
end if
This section compares the text value (topic) of the final section with todays date. If they are different a new row is added. The line "set newRow to make new row at end of rows of doneDoc" seems to be doing two actions the first is to add a new row to the document the second is to set that row to the variable newRow which allows the subsequent line to set the value to todays date.
Code:
-- copy the checked items
duplicate (every row of original whose state is checked and has subtopics of it is false) to end of children of newRow
newRow was created above and this code duplicates every checked row in the list document and pastes them into done.oo3 as children of newrow
Code:
delete (every row of original whose state is checked and has subtopics of it is false)
set expanded of newRow to true
Looking at this code am I correct in thinking that OO3 does not associate rows with other rows other than by their position and level in the list. My code in the original post failed to work in the way I expected because the section headers are not containers in any way and have no knowledge of the rows under them in the document? In order to move a row to a new position in the document I need to write code that locates where the target section is and set a variable to that section. Code can then add new rows as children this row as described above.
Am I alone in finding Applescript both powerful and obscure? The ability to duplicate every selected row in a single command is powerful but I would have never found the command or understood it from reading its dictionary entry.
Thanks for the steer to the example script.
best wishes
Simon