"Explode and group” no longer works

I found a script on this board some years ago that “exploded” an existing document into a series of new documents, one for each paragraph in the old document, and saved them all in a new group. However, for some reason it does not work any more. Does anyone know what is causing it to fail and how to fix it?

Do you use DEVONthink 3? The unmodified script is only compatible to version 2.x.

I’ve posted before, and will again, advising against using scripts that I contributed 5 or more years ago. They are not up to date with DEVONthink, and I will never make an effort to updated them. It would probably be best if DEVONtechnologies just deleted my account to make all those scripts and the bad advice that accompanied them to go away.

Ah. Any sense of how it could be modified to work with DT3?

The last script just appends a number to each paragraph. Is that what you’re expecting? (And you were in on the previous discussion.)

Or how about this…

tell application id "DNtp"
	set validTypes to {rtf, rtfd}
	if selection = {} then return
	repeat with theRecord in (selected records)
		if (type of theRecord) is in validTypes then
			set incr to 1
			set recName to (name of theRecord)
			set newLoc to create record with {name:recName, type:group} in current group -- Keeping things together
			repeat with thisPara in (paragraphs of (text of theRecord))
				if (length of (thisPara as string)) ≥ 2 then create record with {name:(recName & "_para." & incr), type:rtf, rich text:(thisPara as string)} in newLoc
				set incr to incr + 1
			end repeat
			move record theRecord to newLoc -- A little more cleanup
		end if
	end repeat
end tell

image

to…

Hey, thanks very much!

You’re welcome.