• Login
Community
  • Login

Find All Occurrences Macro

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 779 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.
  • M
    Michael Vincent
    last edited by Dec 13, 2019, 1:15 AM

    I have a find all macro that works with hardcoded search string (TODO) but is there a way to create a macro that does find all for the current highlighted word?

    This works for hardcoded “TODO …”:

            <Macro name="TODO Find All" 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="TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO:" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1636" sParam="" />
            </Macro>
    
    

    This does not work for the current word:

            <Macro name="TODO Find All" 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="$(CURRENT_WORD)" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1636" sParam="" />
            </Macro>
    
    

    Cheers.

    A 1 Reply Last reply Dec 13, 2019, 3:39 AM Reply Quote 1
    • A
      Alan Kilborn @Michael Vincent
      last edited by Dec 13, 2019, 3:39 AM

      @Michael-Vincent said in Find All Occurrences Macro:

      is there a way to create a macro that does find all for the current highlighted word?

      Sadly, no. Even more useful would be something like $(PROMPT) which would put up an input box for a user search term to be supplied.

      1 Reply Last reply Reply Quote 1
      • G
        guy038
        last edited by guy038 Dec 13, 2019, 11:26 AM Dec 13, 2019, 11:09 AM

        Hello, @michael-vincent, @alan-kilborn and All,

        Michael, may be I’m missing something obvious !

        Why don’t you use your macro, via its shortcut ( search of TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO: ) to get one instance of the title, presently needed, and then, simply use the Ctrl + F3 or Ctrl + Shift + F3 shortcuts to move around to the next or previous similar title ?

        Best Regards,

        guy038

        M 1 Reply Last reply Dec 13, 2019, 12:20 PM Reply Quote 1
        • M
          Michael Vincent @guy038
          last edited by Dec 13, 2019, 12:20 PM

          @guy038 said in Find All Occurrences Macro:

          Why don’t you use your macro, via its shortcut ( search of TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO: ) to get one instance of the title, presently needed, and then, simply use the Ctrl + F3 or Ctrl + Shift + F3 shortcuts to move around to the next or previous similar title ?

          Thanks, and not to be rude, but that kind of defeats the purpose. Maybe I should have explained a little better. When I mean “Find all Occurrences” I want the search results window to pop up with all occurrences the same as when I:

          1. highlight a word
          2. press CTRL-F
          3. press “Find All in Current Document”

          By making this a macro, I can then add it to the context menu and then a right-click on any word will have a click away, “Find All Occurrences” which will open the clickable search results window.

          Hope that better explains, seems it may not be possible though. Shame the $(CURRENT_WORD) variable can be used in the shortcuts.xml file for the <UserDefinedCommands> commands section, but not the <macros> section.

          Cheers.,

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