Page 1 of 1

Creating multiple files using the 'new item' menu

Posted: 21 Sep 2017 09:53
by roel_v
I have some templates for C++ classes (one .h and one .cpp file) for which I now have custom Visual Studio wizards. But they're a pain to maintain so I'd prefer to replace them with XYplorer scripts somehow.

What I need: when I click somewhere, I need to enter the class name, and then two files should be copied from a well-known directory into the current XYplorer directory. It should do a search/replace within the new files, and replace a well-known placeholder value with the class name I just entered.

What is the easiest way to go about this?

Re: Creating multiple files using the 'new item' menu

Posted: 21 Sep 2017 10:54
by highend
Not possible via "new item" menu

Write a script and put that in a catalog entry, in a popup menu, toolbar button and / or assign it to a keyboard shortcut...

Re: Creating multiple files using the 'new item' menu

Posted: 21 Sep 2017 11:07
by roel_v
OK thanks - is there a way to do search/replace in XYplorer script, or do I just revert to batch files?

Re: Creating multiple files using the 'new item' menu

Posted: 21 Sep 2017 11:13
by highend
Directly in a file without reading it's content first? No.

Script commands: replace / replacelist / regexreplace are your options

To efficiently replace content in files without reading their content,
I personally use https://sites.google.com/site/regexreplace/
(e.g. from XY scripts as well)

Re: Creating multiple files using the 'new item' menu

Posted: 26 Sep 2017 13:31
by highend
And?