Plugin macro copy paste

  • Hello,

    I didn’t find this question answered elsewhere so here I go.
    I’m trying to extract the navigation path of the structure of and XML file. So I want a descending list with each and every row’s XML address. I’m using the built in XML plugin to do this with the shortcut Shift+Ctrl+Alt+P. But it isn’t actually doing anything.

    My current recorded macro sequence when I start with the cursor on the second row of the file, with a second empty file open in a different tab:


    Any help is appreciated!

  • @Frank-Öster

    Because plugin commands change their command ID when plugins are removed or installed, the Macro recorder system does not record plugin commands.

    However, if you’re confident that you won’t be adding or removing plugins for a while, you can work around this.

    1. Record and save the macro as normal. Close/Exit Notepad++ and restart.
    2. Find out what the current command ID for the macro command is.
      • You can do this using the plugin NppUISpy. For example, in my current state, mine is 22148:
    3. Edit %AppData%\Notepad++\shortcuts.xml following guidelines in “Editing Configuration Files”
      1. You’ve already restarted NPP
      2. Open %AppData%\Notepad++\shortcuts.xml
      3. At the top of your macro, add the line
            <Action type="2" message="0" wParam="22148" lParam="0" sParam="" />
        Where the 22148 in the wParam value is whatever command ID is currently assigned to “Current XML Path With Predicates”
      4. Save
      5. Exit Notepad++ completely and restart
    4. Your macro should now include the XMLTools action
    5. Remember: if you install or remove a plugin, you will likely have to edit that wParam value

    Example: I created a macro that I called RunPluginAction, that just consists of that 22148 command

        <Macro name="RunPluginAction" Ctrl="no" Alt="no" Shift="no" Key="0">
            <Action type="2" message="0" wParam="22148" lParam="0" sParam="" />

    … When I run that macro while selecting that macro from shortcuts.xml, I get a popup:
    … which tells me that the XML Tools action is running via the macro.

    It should work similarly for you, given a correct menu command ID.

  • @PeterJones
    Wow it worked flawlessly! I’m just getting in to the space and I’m continuously flabergasted by how powerful a tool NPP can be. It’s exciting really! Thanks for your help, I’m sure that probably existed somewhere but I couldn’t find it with my search criteria…
    I’ll be saving this as a bookmark for sure!


Log in to reply