Group each item script

Hi all,

I am very impressed with DT and have spent some considerable time organising my workflow. I have chosen to follow Muninn’s suggested method

(muninn.net/blog/2010/03/omnioutl … -rows.html)

Being new to apple scripts, I am struggling to get to grips with this stuff. I wonder If anyone have attempted to make a script that creates a group for each item in a group and copies the item title to the new sub-group name. I have a large amount of pdf’s that I would like to organise in this way.

If anyone could suggest how I might go about doing this I will be very grateful indeed.

Kind Regards,

Steve

Just select the documents and run this script:


tell application "DEVONthink Pro"
	set theSelection to the selection
	repeat with theRecord in theSelection
		set theParents to parents of theRecord
		set theGroup to create record with {name:(name of theRecord) as string, type:group} in (item 1 of theParents)
		set cnt to count of theParents
		repeat with i from 2 to cnt
			replicate record theGroup to item i of theParents
		end repeat
		move record theRecord to theGroup
	end repeat
end tell

WARNING: This script doesn’t include any error handling.