Creating custom file types

I’m trying to create some templates for scripts and files that I create on a regular basis. Is it possible to create a custom file type by extension using AppleScript? Basically what I need is a way to create plain-text files with custom extensions, like .rb and .mdwn. I have tried messing with adding Kind and Type values to the create record command, but it always comes in as .txt, even if I attempt to supply a full file name including the custom extension.

Just add .rb or .mdwn files to the templates folder (see Data > New from Template > Open Templates Folder) and update the templates menu afterwards.

Sorry, I wasn’t clear, the template is a .scptd file generating the record out of thin air. I’ve got automatic stuff I need to calculate into the boilerplate, otherwise yeah, I’d just dump a .tex file in there.

Have you looked inside a typical .templatescriptd package in the Templates.noindex subfolder of the DT application support folder? Your script and the boilerplate .rb or .mdwn file can go inside the package, with the boilerplate files loaded up with the tokens that your script replaces for a new instance of your file.

There’s also a brief explanation in the Templates appendix of the Help file.

Got it working; thanks. Wish you could just generate new records with whatever extension you want, from scratch, as it limits what I can do with AppleScript outside of a template context too. But this will work.