Quote:
Originally Posted by makronym
my document was really that simple
|
I'm glad that worked with your data - WhPalmer4's point is a very good one - better to code defensively than to rely on backups.
To skip any rows with more than one child, or with any grandchildren, we could have written something like:
Code:
tell application id "com.omnigroup.OmniOutlinerPro3"
if (count of documents) < 1 then return
tell front document
set oCol to make new column with properties {type:rich text, name:"Moved Children"}
set strColID to id of oCol
set lstParents to (rows where (level = 1) and (has subtopics = true))
repeat with oParent in lstParents
if (count of children of oParent) < 2 then
tell oParent
set oChild to first child
if has subtopics of oChild = false then
set value of cell id strColID to topic of oChild
delete oChild
end if
end tell
end if
end repeat
end tell
end tell