A slight redraft of the format-preserving version. (Gives a slightly cleaner output).
Takes about two seconds to merge three tasks and their notes on my system, but it sounds as if this kind of code may be prohibitively slow with some systems or some data ...
Code:
tell application id "com.omnigroup.omnifocus"
tell content of front document window of front document
set lstTasks to value of selected trees where (class of its value is task or class of its value is inbox task)
if length of lstTasks < 2 then return
set oFirstTask to first item of lstTasks
set lstRest to items 2 thru end of lstTasks
tell oFirstTask -- INSERT TITLE OF FIRST TASK AT START OF ITS OWN NOTE
set refNote to a reference to note
insert name & ":
" at before words of refNote
set refLast to a reference to last character of refNote
duplicate refLast to after refLast
set last character of refNote to "
"
repeat with oTask in lstRest -- APPEND TITLES AND NOTES OF OTHER TASKS TO NOTE OF FIRST TASK
duplicate refLast to after refLast
insert ("
" & (name of oTask) as string) & ":
" at before last character of refLast
delete refLast
duplicate (paragraphs of note of oTask) to after (refLast)
set last character of refNote to "
"
delete oTask
end repeat
end tell
end tell
end tell