Community
    • Login

    macro question re:

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 2 Posters 66 Views 2 Watching
    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.
    • M Offline
      MurraySobol
      last edited by PeterJones

      I am running Notepad++ V8.9.7, 64-bit version on Windows 11 Pro.
      I install/update Notepad++ using an installer package.
      I was trying to add the Global Search stuff and was following these instructions

      • First, we are going to add the macro, described below, within your active shortcut.xml file, right before the line containing </Macros>
              <Macro name="Global Search" 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="(\w)" />
                  <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                  <Action type="3" message="1602" wParam="0" lParam="0" sParam="(?1[[=$0=]]:$0)" />
                  <Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
                  <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
              </Macro>
      

      Reminder :

      • If you installed N++ with an installer package, your active shortcuts.xml file should be within the folder %AppData%\Notepad++

      • If you installed N++ with a portable package, your active shortcuts.xml file should be along with the Notepad++.exe file, in your install folder

      • You may also define a shortcut for this Global Search macro, by opening the Settings > Shortcut Mapper... > Macros tab and double-clicking on the Global Search line !

      When I tried the above I has 2 issues:

      1. I have a “shortcut"s”.xml, not a shortcut.xml file. I assume this was a typo??
      2. I was unable to create a shortcut for this Global Search, When I open the Settings > Shortcut Mapper… > Macros tab I get this result:
        72789460-c4f0-48bd-964b-d8de8f75c99a-image.jpeg
        I don’t see a Global Search line to double-click on.

      Please advise.


      moderator edit: added > for quoting, fixed underlying markdown to match the original post, so that it’s an accurate representation of what @guy038 wrote in the original post).

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

        @MurraySobol ,

        I assume you are talking about this post by @guy038 . If you’re going to create a new topic based on instructions given in a different topic, the least you could do is link to it. (Or you could have just clicked “reply” on that post, as it would have auto-linked, and kept the discussion in one place rather than fracturing it)

        I assume this was a typo??

        The same post lists both shortcut.xml and shortcuts.xml, so the incorrect one was most likely a typo on @guy038’s part.

        I was unable to create a shortcut for this Global Search,

        73970227-2129-43d4-bb3e-bb4ce3a1c416-image.jpeg

        It’s there for me. Is the macro in the Macro menu yet? If not, did you remember to save the shortcuts.xml file and then exit Notepad++ and restart, because Notepad++ doesn’t re-read that config file for new macros when you save it: you have to exit the app and launch it again to have it reload the config files.


        update: Looking at @guy038 's original, he said,

        Reminder :

        • If you installed N++ with an installer package, your active shortcuts.xml file should be within the folder %AppData%\Notepad++

        • If you installed N++ with a portable package, your active shortcuts.xml file should be along with the Notepad++.exe file, in your install folder

        • You may also define a shortcut for this Global Search macro, by opening the Settings > Shortcut Mapper... > Macros tab and double-clicking on the Global Search line !

        Now :

        • Close and restart Notepad++

        • Paste the French text, below, in a new tab ( I rewrote the same French text in different cases ! )

        He should have had the Close and restart Notepad++ before the You may also define ... – he probably didn’t notice, when typing up the instructions, that it might cause confusion.

        Having read my post, he will most likely fix his original, so that it has accurate instructions for future readers.

        1 Reply Last reply Reply Quote 0
        • M Offline
          MurraySobol
          last edited by

          This question is for @guy038.
          I don’t know if I have modified the shortcuts.xml file correctly, here is my file contents:
          <?xml version=“1.0” encoding=“UTF-8”?>
          <NotepadPlus>
          <InternalCommands />
          <Macro name=“Global Search” 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=“(?=\X)(.)|(?!\X).” />
          <Action type=“3” message=“1625” wParam=“0” lParam=“2” sParam=“” />
          <Action type=“3” message=“1602” wParam=“0” lParam=“0” sParam=“(?1(?=[[=$1=]])\X)” />
          <Action type=“3” message=“1702” wParam=“0” lParam=“640” sParam=“” />
          <Action type=“3” message=“1701” wParam=“0” lParam=“1609” sParam=“” />
          </Macro>
          <Macros />
          <UserDefinedCommands>
          <Command name=“Get PHP help” Ctrl=“no” Alt=“yes” Shift=“no” Key=“112”>https://www.php.net/$(CURRENT_WORD)</Command>
          <Command name=“Wikipedia Search” Ctrl=“no” Alt=“yes” Shift=“no” Key=“114”>https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
          <Command name=“Open selected file path in new instance” Ctrl=“no” Alt=“yes” Shift=“no” Key=“117”>$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
          </UserDefinedCommands>
          <PluginCommands />
          <ScintillaKeys />
          </NotepadPlus>

          I was trying to find this line: the line containing </Macros> in shortcuts.xml but did not see it.

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

            @MurraySobol ,

            Please use the </> button on the forum toolbar when you want to paste example text, and put the text where it says code_text when you do that. That way, your example text won’t be interpreted as “markdown”, so that we know that your example text is coming through the way you pasted it.

            @MurraySobol said:
            This question is for @guy038.

            Why limit it, when anyone else with the knowledge can answer as well?

            I don’t know if I have modified the shortcuts.xml file correctly,

            You have not. The <Macro name=...>...</Macro> must be between <Macros> and </Macros>

            here is my file contents:

            <?xml version="1.0" encoding="UTF-8"?>
            <NotepadPlus>
                <InternalCommands />
                    <Macro name="Global Search" 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="(?=\X)(.)|(?!\X)." />
                        <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                        <Action type="3" message="1602" wParam="0" lParam="0" sParam="(?1\(\?=[[=$1=]]\)\\X)" />
                        <Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
                        <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                    </Macro>
                <Macros />
                <UserDefinedCommands>
                    ...
                </UserDefinedCommands>
                <PluginCommands />
                <ScintillaKeys />
            </NotepadPlus>
            

            I was trying to find this line: the line containing </Macros> in shortcuts.xml but did not see it.

            Looks like the updated XML libary that Notepad++ now uses is changing empty

                <Macros>
                </Macros>
            

            into

                <Macros />
            

            … which is valid XML, but annoying when people are trying to explain how to edit macros manually.

            To follow @guy038’s instructions, you will have to change

                <Macros />
            

            into

                <Macros>
                </Macros>
            

            and then put the macro inside it, like:

                <Macros>
                    <Macro name="Global Search" 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="(?=\X)(.)|(?!\X)." />
                        <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                        <Action type="3" message="1602" wParam="0" lParam="0" sParam="(?1\(\?=[[=$1=]]\)\\X)" />
                        <Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
                        <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                    </Macro>
                </Macros>
            
            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors