Convert row to note of parent row?

Daniel Flatin dflatin at rcn.com
Sun Jan 15 18:09:23 PST 2006


I posted this script several weeks ago requesting advice on how to  
make the last line work (and any other advice -- I am only an  
occasional scripter), but I guess no-one saw it. In any case, it  
takes the selected rows and concatenates them into a note in the  
parent row. It has several flaws, but it seems to get the basic job  
done -- except for deleting the selected rows afterward.

tell application "OmniOutliner Professional"
	set MyDoc to front document
	set theRows to selected rows of MyDoc
	set theParent to parent of (first item of theRows)
	set noteText to note of theParent
	repeat with theRow in theRows
		tell theRow
			if (noteText is not "") then
				set noteText to noteText & return & topic
			else
				set noteText to topic
			end if
		end tell
	end repeat
	set note of theParent to noteText
	delete (every row of theRows) -- this line doesn't work
end tell

On Jan 15, 2006, at 20:16, Curt Clifton wrote:

> John,
>
> On Jan 15, 2006, at 5:50 PM, John Laudun wrote:
>
>>
>> Here's something that happens to me regularly: I realize that a  
>> row, or
>> series of rows, really should be a note attached to the parent  
>> row. The
>> ability to do this is not built into OO Pro itself, but is it  
>> possible to
>> write an AppleScript to do this -- if someone would but say yes, I  
>> would try
>> it myself.
>>
>> Of course, it would also be cool to have a script that would do  
>> the reverse,
>> transform notes into child row(s).
>
> Here's a script to do the reverse that I had lying around.  Turning  
> child rows into a note is also doable.
>
> -- Splits notes of selected row into multiple rows, one for each  
> paragraph
> -- Leaves all other data for the selected row attached to the  
> original row
> tell front document of application "OmniOutliner Professional"
> 	try
> 		set v_selrow to selected row 1
> 	on error
> 		beep
> 		display dialog "You must select a row to split." buttons  
> {"Close"} default button "Close"
> 		return
> 	end try
> 	
> 	set v_parent to v_selrow
> 	set v_topic to note of v_selrow
> 	set theParagraphs to every paragraph in v_topic
> 	
> 	-- Nothing to do? Then do it.
> 	if (count of theParagraphs) is 0 then return
> 	
> 	-- Creates the new rows
> 	tell v_parent
> 		repeat with v_p in theParagraphs
> 			make new row with properties {topic:v_p} at ¬
> 				after last child of it
> 		end repeat
> 	end tell
> 	
> 	set note of v_selrow to ""
> 	set expanded of v_selrow to true
> end tell
>
>
> Cheers,
>
> Curt_______________________________________________
> 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