Applescript to break up a sheet?

I have a sheet with thousands of records – the result of importing a tab-delimited Filemaker dump.

I would like to turn these sheet records into a folder of rich text items. Further, I’d like one or two of the sheet fields to end up in the rich text item’s Comments.

Does anyone know of an Applescript to do this? Or point me to docs or other resources? I haven’t done any Applescripting in ages, and so far haven’t even examined the AS dictionary of DT Pro. But I can and will, if need be. Nor have I played at all with Automator. (This doesn’t seem an Automator thing, but maybe I’m wrong.)


You could try something like this:

tell application "DEVONthink Pro"
	set theSel to the selection
	repeat with theItem in theSel
		if type of theItem is form then
			set theText to plain text of theItem
			set theName to name of theItem
			create record with {name:theName, type:txt, plain text:theText}
		end if
	end repeat
end tell

Before executing this script, select one or more records (e.g. in the upper right pane of three-pane views). Then this script will create a plain text (records don’t have any formatting anyway and rich text scripting of Mac OS X is VERY limited) for each selected record.

Thanks very much, Christian.

Is there a way to set variables to the content of specific cells of theItem? I see that there is DT AS verb called “get cell at,” so I tried:

set theComment to get cell at column 7 of theItem

Not too surprisingly, that didn’t work (I got the error “Access not allowed” when I tried to compile the script). Do you know what syntax would work? Thanks.

Just try this:

set theCells to cells of theItem
set anExampleCell to item 5 of theCells

The get/set cell at … commands are only supported by visible sheets, e.g. to validate or edit them.

Thanks, Christian. That syntax is exactly what I needed.