Community
    • Login

    Alt+l+x tag is not adding in macro

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 3 Posters 508 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.
    • VijayPrabakarV
      VijayPrabakar
      last edited by

      I started a macro and align the text and want to format the content to xml at the end of the macro. I stopped the macro. while I Playback the macro it performs all the activities which I have done except formatting the content to XML. Please help.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @VijayPrabakar
        last edited by

        @vijay-S ,

        If I understand you correctly, you would like to set the file to XML at the end of your macro. You are correct, the Language menu’s XML entry does not get recorded when you record a macro (there are many menu entries that do not record correctly, for a variety of reasons). However, if you are willing to manually edit the macro after you record it, you may add that command to the macro.

        Per https://npp-user-manual.org/docs/config-files/#macros , you can look at the IDM_... values in menuCmdID.h in the source code to find wParam values for type="2" actions. The IDM_LANG_XML action resolves to a value of 46006. When you include that in the macro, then it changes the language to XML, just like that menu entry.

        1. Record and save your macro (if this is already done, move on to step #1)
        2. Close all instances of Notepad++
        3. Open one single instance of Notepad++
        4. File > Open %AppData%\Notepad++\shortcuts.xml
        5. Search for the name of your macro. In my case, I used npp19956 (after the topic number in the URL)
          <Macro name="npp19956" Ctrl="no" Alt="no" Shift="no" Key="0">
              <Action type="0" 1message="2316" wParam="0" lParam="0" sParam="" />
          </Macro>
          
        6. Add <Action type="2" message="0" wParam="46006" lParam="0" sParam="" /> to the end of the Macro
          <Macro name="npp19956" Ctrl="no" Alt="no" Shift="no" Key="0">
              <Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
              <Action type="2" message="0" wParam="46006" lParam="0" sParam="" />
          </Macro>
          
        7. Save shortcuts.xml
        8. Exit the Notepad++ application
        9. Run a new instance of Notepad++.

        The Macro should now have a last action to change the language to XML, just like the Language > XML menu entry.

        VijayPrabakarV 1 Reply Last reply Reply Quote 4
        • VijayPrabakarV
          VijayPrabakar @PeterJones
          last edited by

          @PeterJones said in Alt+l+x tag is not adding in macro:

          File > Open %AppData%\Notepad++\shortcuts.xml

          ``
          File > Open %AppData%\Notepad++\shortcuts.xml

          I am not seeing the file

          Instead I saw

          %AppData\Roaming\Notepad++\shortcut.xml . But I am not find my save macro
          there

          ``

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • VijayPrabakarV
            VijayPrabakar
            last edited by

            @PeterJones said in Alt+l+x tag is not adding in macro:

            Add <Action type=“2” message=“0” wParam=“46006” lParam=“0” sParam=“” /> to the end of the Macro

            ``

            Please ignore this. I found the xml in other path and it works like a charm

            ``

            1 Reply Last reply Reply Quote 0
            • VijayPrabakarV
              VijayPrabakar
              last edited by

              ``

              can you tell me the reason why it was not working without adding the additional entry and how can we fix for other issue… is there any tutorial

              ``

              1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @VijayPrabakar
                last edited by

                @vijay-S said in Alt+l+x tag is not adding in macro:

                I am not seeing the file
                Instead I saw AppData\Roaming\Notepad++\shortcut.xml

                That’s because you didn’t type (or paste) the text I wrote; instead, you manually navigated and thought I meant AppData when i said %AppData%. %AppData% is an environment variable, explained more in this FAQ.

                can you tell me the reason why it was not working without adding the additional entry

                I told you as much as I know for the “why”: “there are many menu entries that do not record correctly, for a variety of reasons”

                • official docs: macro overview = https://npp-user-manual.org/docs/macros/
                • official docs: macro syntax in shortcuts.xml = https://npp-user-manual.org/docs/config-files/#macros
                1 Reply Last reply Reply Quote 3
                • VijayPrabakarV
                  VijayPrabakar
                  last edited by

                  `` one more

                  I have a single line big xml. I want to format in xml. I want to do this without downloading TExtFX or XMl tools plugin.

                  is there any way

                  ``

                  Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn @VijayPrabakar
                    last edited by

                    @vijay-S said in Alt+l+x tag is not adding in macro:

                    I want to format in xml.

                    I suppose you start by defining what kind of formatting you want to do.

                    1 Reply Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones @VijayPrabakar
                      last edited by PeterJones

                      @vijay-S said in Alt+l+x tag is not adding in macro:

                      I have a single line big xml. … without downloading TExtFX or XMl tools plugin.
                      is there any way

                      Notepad++ does not have any native XML formatting tools built in.

                      I understand that having XML (or HTML, or any other code) all on a single line with no line breaks can be annoying.

                      There are two good ways and a bad way to format XML (or any other code), and a fourth way that is really just a lame workaround:

                      1. Download a plugin that already handles it, like XML Tools.
                        • You have rejected this without giving a reason, even though this is the best answer to give you
                        • Note: TextFX hasn’t been maintained in years, and thus hasn’t kept up-to-date with modern Notepad++. I wouldn’t recommend that route.
                      2. Download a tool unrelated to Notepad++ which will give you an external .exe file which will format your XML for you.
                        • This is better than nothing, but not as convenient as having it in a Notepad++ plugin
                        • @Michael-Vincent has posted that he uses tidy5 for XML, and runs that (and other code tidy apps) using an NppExec script shared in another post. Of course, that also involves a plugin, so even though it’s another good suggestion, you are likely to reject it.
                      3. Do a poor-man’s “xml tidy”, which just involves splitting at the end > of every XML tag.
                        • FIND = >, REPLACE = >\r\n will put a newline after ever >
                        • This will not do any fancy indenting
                        • If you want fancy indenting, use a tool developed for the job, like the XML Tools plugin or tidy5 or whatever other external tool you want
                      4. Workaround: Turn on word-wrap, and Notepad++ will at least visually wrap, so you can change the width of your editor window to decide how many characters will be shown per “line”. Please note that this doesn’t change the underlying XML, so that will still all be one big long line.

                      Rejecting pre-made and already-debugged solutions will only hurt you and the quality of your work. Thinking that we will re-invent the wheel for you, just because you don’t happen to like a particular brand of tire, could be considered rather selfish. I recommend using suggestion #1 or #2. Good luck.

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