Batch creation from rtf template

Hi does anybody knows how to batch create x copies of an rtf record (which is actually in my templates) and name it after the original name and subsequent number?
I have a template file to record each class I teach called “Lesson n.” and when i start preparing the course I’d like to automatically create 1 new file per lesson
Can somebody help?

There are a couple of approaches demonstrated in the standard DT templates. Look in:

~/Library/Application Support/DEVONthink Pro 2/Templates.noindex

First, look at the items in the Classifications subfolder with a .dtTemplate extension. In Finder, you’ll need to select on of these and use Show Package Contents from the contextual menu (control-click). Inside a .dtTemplate package (a folder, it is) you’ll see a set of folders. What happens with .dtTemplates is that opening them in DT causes that folder structure to be replicated as groups. It doesn’t have to be just folders - it could include documents - e.g., the RTF template you’ve already built.

Then, look at the items in the Registers subfolder of Templates.noindex. In that folder you’ll find items with the .templatescriptd extension. These are also packages, so look inside with Show Package Contents. The structure is more sophisticated. There are templates (in the *.lproj folders) and a script (in Contents/Resources/Scripts) When a .templatescriptd item is selected from the Data > New from Template menu in DT, the script executes and builds a document, with substitutions for names, etc.

The first method (a .dtTemplate template) doesn’t get you the name substitutions you want, but it is easy to set up and is good for when you want to repeatedly create the same folder & or document structure. You can use one of the Scripts > Rename scripts to do the renaming.

The second method will get you all you want, but involves detailed scripting and development. You’ll need to examine and learn from the scripts, as well as the forum - where searching for topics regarding templates can help quite a bit.

Thanks Korm for the detailed explication
I think I couldn’t explain what I’m trying to achieve; I have already made some templates in DT, what I don’t know is how to script the creation of x records (from an rtf file or a template) and name them after the name of the selected record and a progressive number…