Community
    • Login

    Plugin macro copy paste

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 906 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Frank ÖsterF
      Frank Öster
      last edited by

      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:

      Shift+Ctrl+Alt+P
      Enter
      DwnArrow
      Ctrl+Pgdown
      Ctrl+V
      Enter
      Ctrl+Pgdown

      Any help is appreciated!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Frank Öster
        last edited by

        @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:
            02ed15e7-149f-407f-8a0b-1a51978aca93-image.png
        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="" />
            </Macro>
        

        … When I run that macro while selecting that macro from shortcuts.xml, I get a popup:
        56150085-8663-490b-a632-6b2fc108c81a-image.png
        … 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.

        1 Reply Last reply Reply Quote 5
        • Frank ÖsterF
          Frank Öster
          last edited by

          @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!

          Thanks!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors