How to apply text style to section of text using script?

Hi

I have a script that cycles through paragraphs in an RTF file and depending on what it finds in the paragraph, the script performs different actions.

For some of these paragraphs I would like the text in the paragraph copied to a new record in DT. I have everything working except I can’t work out how to set the weight of the font for a given paragraph.

So the stages are essentially as follows:

set theText to text of window 1
set theParagraph to paragraph j of theText
set paraText to text of theParagraph

then I want to set the font weight of paraText. I tried the following:

set font of paraText to “Optima-BoldItalic”

but I got an error message stating that I couldn’t set the font.

Could someone help me with the correct statement here?

Thanks

Nick

Rich text scripting is kind of tricky because it doesn’t support variables/properties, only visible views/windows. Therefore it should work like this:


tell application "DEVONthink Pro"
	tell text of window 1
		set font of paragraph 1 to "Optima-BoldItalic"
	end tell
end tell