[macros] How to write macro for Notepad++?

Posting more than 10 years after the OP, but I think that this is still a relevant question (it is for me, at least). Today, there is quite some information in the Notepad++ User Manual, relating to the OP's question:

Here is a block of macro code: replace SEARCHTEXT by REPLACETEXT, using regular expressions, "." finds /r and /n, in every file matching the filter GLOBFILEFILTER in a folder PATH (no subfolders, not sure where this flag is defined/set).

<Macro name="REPLACE_IN_FILES_REGEX_DOT_FINDS_CR_AND_LF" Ctrl="no" Alt="no" Shift="no" Key="0">
    <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
    <Action type="3" message="1601" wParam="0" lParam="0" sParam="SEARCHTEXT" />
    <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
    <Action type="3" message="1602" wParam="0" lParam="0" sParam="REPLACETEXT" />
    <Action type="3" message="1653" wParam="0" lParam="0" sParam="PATH" />
    <Action type="3" message="1652" wParam="0" lParam="0" sParam="GLOBFILEFILTER" />
    <Action type="3" message="1702" wParam="0" lParam="1024" sParam="" /> 
        <!-- #COMMENT: "1024" seems to be the flag ". finds /n and /r". This is not in the documentation. -->
    <Action type="3" message="1701" wParam="0" lParam="1660" sParam="" />
</Macro>

Remarks about this code:

  • The path to the folder needs to end with a backslash.
  • Characters like <, >, & need to be escaped in the xml. Rather create your search and replace strings by recording a macro.