"Merge Rows" applescript

Brian C. dvorak at omnigroup.com
Wed Oct 19 17:17:14 PDT 2005


A customer asked for the ability combine several items from the same 
level into one multi-lined entry.

The following AppleScript doesn't do *exactly* what the customer was 
asking for - it doesn't enforce the "from the same level" restriction, 
for example - but it's close. Figured it might be useful to some of you 
out there in the real world, as well.

(The script will work in OO standard if you just trim the application 
name in the first line before saving it in script editor.)

bwc


tell front document of application "OmniOutliner Professional"
	set theText to ""
	set theCount to (count of selected rows)
	if theCount < 2 then
		display dialog "You need to select at least two rows to use this 
script." buttons "Cancel" default button "Cancel"
	end if
	
	set theFirstSelected to first item of selected rows
	
	repeat with i from 1 to (theCount - 1)
		set theText to theText & (topic of (item i of selected rows)) & "/n"
	end repeat
	
	-- now stick the text of the last row on by hand
	-- without the trailing newline
	set theText to theText & (topic of last item of selected rows)
		
	make new row with properties {topic:theText} at before theFirstSelected
	repeat with aRow in selected rows
		delete row id (id of aRow)
	end repeat
end tell




More information about the OmniOutliner-Users mailing list