Create multiple files based on one input name

Hi,
I'd like to create an .h and .cpp file using one command. So that I input a name once and a "MyFileName.h" and "MyFileName.cpp" will be created
I tried
FileType NEW=.txt NEWNAME="empty."
FileType NEW=.txt NEWNAME="empty."
that creates one file, let's me input a name and creates another file and let's me input the name but that's not that much of an improvement.

I'm sorry I cannot help you with your issue, but I can welcome you to our forum :smiley:

So welcome, BoomRaccoon!

1 Like

This will ask for a name, create a .cpp and .h file, scroll both into view and select them (deselecting anything that was selected before):

@set basename={dlgstring|Enter name for .cpp and .h files:}
FileType NEW=.txt NEWNAME="norename:{$basename}.cpp"
FileType NEW=.txt NEWNAME="norename:{$basename}.h"
Select EXACT PATTERN="{$basename}.h" MAKEVISIBLE=immediate DESELECTNOMATCH
Select EXACT PATTERN="{$basename}.cpp" MAKEVISIBLE=immediate

If needed: How to use buttons and scripts from this forum

2 Likes

Thanks a lot :grinning:

What are some resources to get started writing these kind of commands? My guess is that the main ones are
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Command_Reference.htm
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Internal_Commands.htm
but you might have some more goodies you could add to your post

Those are the best places to start.