Lars Fosdal 1792 Posted August 26, 2021 Whenever I write console test app, I am annoyed that I must change from program Project2; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; begin try { TODO -oUser -cConsole Main : Insert code here } except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. to program Project2; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; begin try try except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; finally {$ifdef Debug} Write('Press Enter: '); Readln; {$endif} end; end. which is what I normally want. Is there a way to replace the default code template for a new console project? I would have expected to find it under Tools | Template Libraries - but there is no console project there. Share this post Link to post
Uwe Raabe 2057 Posted August 26, 2021 AFAIK that is not possible. It is hard-coded in delphicoreide<xxx>.bpl 1 Share this post Link to post
Attila Kovacs 629 Posted August 26, 2021 I've multiple template dirs which I duplicate for the new (test)projects. There is life outside the IDE too. Share this post Link to post
Guest Posted August 26, 2021 https://www.delphipower.xyz/guide_7/adding_new_application_templates.html Alternatively, you could write a design-time IDE extension implementing IOTAProjectCreator interface. Share this post Link to post
Fr0sT.Brutal 900 Posted August 26, 2021 (edited) Alternative could be Ctrl-A, Delete, "cons", Space + predefined code template named "cons" with the contents you want. Edited August 26, 2021 by Fr0sT.Brutal 1 Share this post Link to post
corneliusdavid 214 Posted August 26, 2021 Why not simply use one of the oldest features of Delphi, The Object Repository? Not only can you store a pre-designed Form Template for reuse but you can create an application and store the whole application as a Project Template. In your case, the project would simply be a single-file .DPR. Here's an old YouTube Video that explains how to use the Object Repository--the latter half demonstrates project templates. 3 Share this post Link to post
Attila Kovacs 629 Posted August 27, 2021 16 hours ago, corneliusdavid said: Why not simply use one of the oldest features of Delphi, The Object Repository? AFAIR they disappeared every time I installed an update, I don't know, could have been a one-time issue. Share this post Link to post