How to create a macro in notepad ++ to read a template and write it to the current file?

  • I want to make templates for different programming languages. I did the following:

    • Start macro recording

    • I opened a file from notepad ++. (This file is a template I made).

    • I copied the entire content of this file and inserted it into a file that I had created earlier.

    • I closed the file and finished the macro.

    When I ran the macro I saw that it had not copied all the content of the template, but simply pasted everything that was on the clipboard.<br/>
    This is where the question comes from.

  • @Daniel-Briceño

    The clipboard commands in macros are literal. This means that they can work with variable data found on the clipboard when the macro is run.

    To do what you want, you’d have to, while recording a macro, actually type out the text you want to end up with. Or you could edit shortcuts.xml (where the macros are stored) to make it a bit easier to add your text.

    Isn’t a better way just to keep your template where you already have it (separate file), and when you need it copy the contents of that file into a new file that needs it?

    Alternatively, you could open your template file and then use the SaveAs command to create a new file with its contents.

  • @Alan-Kilborn Gracia.