Rename > To RTF Title?

I’m trying to figure out how to batch rename about 100k RTF files to the title. I know I can do this for HTML with the script under the Rename section of the script menu. This does not work for RTF, however, because the script looks for only HTML and webarchive. I tried duplicating the script and changing the “this_type” argument to RTF rather than HTML, but that had no effect. Does anyone know a fast way to rename RTF files to the title?

Thanks in advance

Here’s a modified version of the script Rename > To Subject which supports e.g. RTF & PDF documents:

tell application id "DNtp"
		set theSelection to the selection
		if theSelection is {} then error "Please select some contents."
		repeat with theRecord in theSelection
				set theMD to meta data of theRecord
				set name of theRecord to |kMDItemTitle| of theMD
			end try
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

Great, thanks. I’ll give it a go!