Get lines of text from records

I need to get the content of each of the first six lines of a DTp record into variables in an apple script. How do I do that?

I try e.g. the script

repeat with theRecord in theSelection
set hode to second paragraph of plain text of theRecord

			set name of theRecord to hode

but get no text, nor with constructions like

get second line of plain text of theRecord.

But just the line

get plain text of theRecord

give me the whole text of he record.

Any way to adress single lines only?

You are very close…

tell application "DEVONthink Pro"
	activate
	set selectedItems to the selection
	repeat with z from 1 to count selectedItems
		try
			set itemText to plain text of item z of selectedItems
			set name of item z of selectedItems to second paragraph of itemText
		end try
	end repeat
end tell

I added try/end try to avoid problems if your record does not contain ‘plain text’ or has no second, third… paragraph.

Thanks a lot for the tip - it worked!
I still have a problem when I try to modify the creation date. The script is as follows:

tell application "DEVONthink Pro"
	activate
	set selectedItems to the selection
	repeat with z from 1 to count selectedItems
		try
			set itemText to rich text of item z of selectedItems
			set name of item z of selectedItems to second paragraph of itemText
			set creation date of item z of selectedItems to first paragraph of itemText
		end try
	end repeat
end tell

The line with the name works, and the script seems to get the right line containing the date. The event log shows e.g.:

set name of child id 7969 of child id 7278 of record id 7148 of database 1 to "Aesthetics at work"
	set creation date of child id 7969 of child id 7278 of record id 7148 of database 1 to "22.3.2005 11.49.00"

and the name is set as it should, but not the date. Is there an issue with date formats?

Tellef

Tellef:

Take a look at the new “Date” scripts included in DT Pro 1.0p2. There are routines for modifying creation date.

Yes, I have done that, and believe I use the same syntax. I have also tried different date formats, without success.
Tellef