Feature Request: Convert child items to notes and vice-versa

It would be great to be able to convert comma seperated notes into child items and likewise convert child items into notes for the parent item.

Any was this could be incorporated (or done via. Applescript?)

2 Likes

@Brusseloi

Rob Trew’s scripts at http://forums.omnigroup.com/showthread.php?t=26709 will merge child items into the parent’s note. They work in OO5. I use this one:

-- http://forums.omnigroup.com/showthread.php?t=26709
-- provided AS IS by Rob Trew, with minor changes by SG
-- collects topics and notes of children of selected line and places in note
-- IF YOU *REALLY* WANT TO DELETE THE CHILD NOTES
-- THEN CHANGE THE VALUE OF THIS PROPERTY TO TRUE …
property pblnReallyDeleteDescendants : false

tell application id "OOut"
	set lstDocs to documents
	if length of lstDocs < 1 then return
	
	tell first item of lstDocs
		set lstSeln to selected rows
		if length of lstSeln < 1 then return
		tell first item of lstSeln
			if has subtopics then ¬
				set its note to its note & my GetSubText(its children)'s text 1 thru -3
			set its note expanded to true
		end tell
	end tell
end tell

on GetSubText(lstChiln)
	tell application id "OOut"
		set str to ""
		-- CAPTURE THE TEXT
		repeat with oChild in lstChiln
			tell oChild
				set str to str & its topic & return & its note & return & return
				if has subtopics of it then set str to str & my GetSubText(its children)
			end tell
		end repeat
		
		-- AND THEN DELETE THE CHILDREN ? 
		if pblnReallyDeleteDescendants then
			repeat with i from length of lstChiln to 1 by -1
				delete item i of lstChiln
			end repeat
		end if
		return str
	end tell
end GetSubText
1 Like

Hi – I found this script useful. But I wanted to be able to convert ALL child rows to notes of their first order headings. So (mostly through trial and error) I modified Rob Trew’s script to do this.

This script should start at the beginning of your document, and convert all child rows, of whatever level, to notes of the first-order headings that precede them. I would recommend trying this on a copy of your document first, as I am an absolute beginner in Applescript.

http://forums.omnigroup.com/showthread.php?t=26709
– provided AS IS by Rob Trew, with minor changes by SG
– collects topics and notes of children of selected line and places in note
– IF YOU REALLY WANT TO DELETE THE CHILD NOTES
– THEN CHANGE THE VALUE OF THIS PROPERTY TO TRUE …
property pblnReallyDeleteDescendants : true
– Modified by Gregory MacIsaac (June 2017) to do the same for all first order headings in a document – as written I have left ‘delete child notes’ to true

tell application “OmniOutliner”
tell front document
set rowCount to count of rows
repeat with i from 1 to rowCount

		tell first item
			set lstSeln to selected rows
			if length of lstSeln < 1 then return
			tell first item of row i
				if has subtopics then ¬
					set its note to its note & my GetSubText(its children)'s text 1 thru -3
				set its note expanded to true
			end tell
		end tell
	end repeat
end tell

end tell

on GetSubText(lstChiln)
tell application id “OOut”
set str to “”
– CAPTURE THE TEXT
repeat with oChild in lstChiln
tell oChild
set str to str & its topic & return & its note & return
if has subtopics of it then set str to str & my GetSubText(its children)
end tell
end repeat

	-- AND THEN DELETE THE CHILDREN ? 
	if pblnReallyDeleteDescendants then
		repeat with i from length of lstChiln to 1 by -1
			delete item i of lstChiln
		end repeat
	end if
	return str
end tell

end GetSubText

PS – Don’t know why when I posted it some is in plain text and some is in boxes. Just select the whole thing and paste it into the script editor.

Greg M.