Community
    • Login

    How to edit the XML macros in NotePad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 4.4k 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.
    • Arhack BifrostA
      Arhack Bifrost
      last edited by

      Context: I want to automate the “search in files” for a certain list of strings for example

      myAwesomeVariable1
      myAwesomeVariable2
      myAwesomeVariable3
      myAwesomeVariable4
      

      search for myAwesomeVariable1 show its results then myAwesomeVariable2 and so on, the resulats will be somthing like that

      Search "myAwesomeVariable1" (34 hits in 4 files)
      Search "myAwesomeVariable2" (6 hits in 5 files)
      Search "myAwesomeVariable3" (7 hits in 6 files)
      Search "myAwesomeVariable4" (4 hits in 1 files)
      

      As solution I thought of using a macros which select the first element then “search in file” [using the CTRL+SHIFT+F] go the 2nd one and so on but when I looked at the code behind the macros i found the following

      <Macro name="myMacrosSearcher" 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="myAwesomeVariable1" />
                  <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                  <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                  <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                  <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                  <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />   
              </Macro>
      

      so the sParam for action “1601” is hard coded as myAwesomeVariable1 means each time I run this macros I get resulats of myAwesomeVariable1

      Question : what is the syntaxe so I can store my list in array of string then pass it to the sParam and repeat that in a loop so my code will be something like:

      <Macro name="myMacrosSearcher" Ctrl="no" Alt="no" Shift="no" Key="0">
      arrayOfString[4] = {myAwesomeVariable1, myAwesomeVariable2, myAwesomeVariable3, myAwesomeVariable4}
                      for(i = 0;i<3;i++)
                      {
                      <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1601" wParam="0" lParam="0" sParam=arrayOfString[i] />
                      <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                      <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                      <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                      <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />   
                      }
                  </Macro>
      
      dinkumoilD 1 Reply Last reply Reply Quote 0
      • rinku singhR
        rinku singh
        last edited by

        simply replace in shortcuts.xml file from

        <Macro name="myMacrosSearcher" 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="myAwesomeVariable1" />
                    <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                    <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                    <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                    <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />   
                </Macro>
        

        to

        <Macro name="myMacrosSearcher" 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="myAwesomeVariable1" />
                    <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                    <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                    <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                    <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />   
        
                    <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1601" wParam="0" lParam="0" sParam="myAwesomeVariable2" />
                    <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                    <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                    <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                    <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" /> 
        
                    <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1601" wParam="0" lParam="0" sParam="myAwesomeVariable3" />
                    <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                    <Action type="3" message="1653" wParam="0" lParam="0" sParam="my_path" />
                    <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.txt*" />
                    <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                    <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" /> 			
                </Macro>
        
        Arhack BifrostA 1 Reply Last reply Reply Quote 1
        • Arhack BifrostA
          Arhack Bifrost @rinku singh
          last edited by

          @gurikbal-singh thanks for your help, i already dulpicated it to make sure the approach is correct but isn’t “handy” assuming that I have 1000 terms to search for

          1 Reply Last reply Reply Quote 0
          • dinkumoilD
            dinkumoil @Arhack Bifrost
            last edited by

            @Oussama-Moustakim

            I already told you in >>> this thread <<< that you need a scripting solution or you use the FindStr workaround I’ve posted there.

            Your problem will not be solved only by repeating your question. If you don’t want to use my workaround, ask the community for help to script a proper solution instead of flooding the forum with the same question.

            Arhack BifrostA 1 Reply Last reply Reply Quote 3
            • Arhack BifrostA
              Arhack Bifrost @dinkumoil
              last edited by

              @dinkumoil Thanks for the “FindStr” solution it seems to work but not in a “neat” way since the resulat are mixed and I want to stick to a “NotePadian” solution (this way I can get my hand dirty with some scripts and maybe plugin devloppement), my post here was to see the possibilities i can get by manipulating the macros file and not a repetition of the issue.
              currently I’m working on a script using PyhtonScript as you suggested and I’m sure the community will be great help for me

              cheers

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