User Tools

Site Tools


Sidebar


Site Information


Interactive Maps

Sidebar

wiki:misc:notepadpp

Notepad++

Macros

Macros are stored in %APPDATA%/Notepad++/shortcuts.xml

For example:

I have templates I use for referencing articles I've found. Unfortunately, unlike Textpad, NotePad++ (NPP) doesn't have any method for dynamically substituting today's date in any format. So I'm forced to get creative. Knowing where the macros are stored and that they are editable, I can edit the macro, and the execute it to quickly make the replacements - and since I usually find many articles on a given topic, this can reduce my effort.

There's one problem: it seems editing the source, saving, and closing doesn't update what was in NPP's memory cache. I have to close NPP and restart to insure the change is read! Small cost to pay.

The following macro, named gcSetDate, searches for MonDDYYYY and replaces it with June 12, 2018. It then replaces DATE_ with 180612_. Last it finds ArticleTitle and stops (in the editor, ArticleTitle will be selected, ready to edit).

        <Macro name="gcSetDate" 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="MonDDYYYY" />
            <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="June 12, 2018" />
            <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="DATE_ " />
            <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="181204_" />
            <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="ArticleTitle" />
            <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
            <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
        </Macro>
wiki/misc/notepadpp.txt · Last modified: 2018/06/04 15:53 by terrill