• Login
Community
  • Login

Macro Selecting Search Results Text and pasting into new file

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 2.2k 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.
  • P
    Phil Grigg
    last edited by Mar 1, 2019, 7:45 PM

    I am trying to write a marco to search specific text strings and then copy the results into a new notepad++ file. I cannot get the marco to copy the search window results.

    1 Reply Last reply Reply Quote 1
    • T
      Terry R
      last edited by Mar 1, 2019, 8:02 PM

      @Phil-Grigg I’m not sure if you want to create a macro as you think that’s the only way to fix your issue or that you DO want a macro. But in terms of what you seem to want may I suggest reading another recent post.
      https://notepad-plus-plus.org/community/topic/17209/find-text-copy-and-paste-to-another-file
      Where the solution may meet your needs of getting specified text from a file into another tab in Notepad++.
      Terry

      1 Reply Last reply Reply Quote 2
      • P
        Phil Grigg
        last edited by Mar 1, 2019, 8:08 PM

        preferably, I need a macro to do this. I have hundreds of files I am searching and want to search the find in file results.

        A 1 Reply Last reply Mar 1, 2019, 8:34 PM Reply Quote 0
        • A
          Alan Kilborn @Phil Grigg
          last edited by Mar 1, 2019, 8:34 PM

          @Phil-Grigg

          Macros really only operate for editing commands (i.e., things you can do in the area where you can free-form edit text). So it is not surprising to me that you can’t do things involving the Find result panel and macro recording.

          P 1 Reply Last reply Mar 1, 2019, 11:57 PM Reply Quote 5
          • P
            Phil Grigg @Alan Kilborn
            last edited by Phil Grigg Mar 1, 2019, 11:57 PM Mar 1, 2019, 11:57 PM

            @Alan-Kilborn it should’nt be. Search in files for atext string “Error”:
            <Action type=“3” message=“1700” wParam=“0” lParam=“0” sParam=“” />
            <Action type=“3” message=“1601” wParam=“0” lParam=“0” sParam=“Error” />
            <Action type=“3” message=“1625” wParam=“0” lParam=“0” sParam=“” />
            <Action type=“3” message=“1653” wParam=“0” lParam=“0” sParam=“X:\Logs” />
            <Action type=“3” message=“1652” wParam=“0” lParam=“0” sParam=“*.log” />
            <Action type=“3” message=“1702” wParam=“0” lParam=“32” sParam=“” />
            <Action type=“3” message=“1701” wParam=“0” lParam=“1656” sParam=“” />

            A 1 Reply Last reply Mar 2, 2019, 1:38 PM Reply Quote 0
            • T
              Terry R
              last edited by Mar 2, 2019, 3:22 AM

              @Phil-Grigg
              Thinking about what you are trying to do, I think a possible solution will be along the lines of the recent post I referred to.
              So firstly you would make a copy of all the log files (your macro code seems to work on *.log files) into another folder/location.
              Depending on where in the line the “Error” text lies your macro code would use a regex (as per the recent post) to put the text you want to remain on separate lines (if an entire line is the error text then you may be able to skip this step). Then another regex would remove ALL lines not starting with “Error”. This macro could operate using the “find in files” as per your wish.
              The result will be files only containing the text which you did NOT delete.

              Terry

              1 Reply Last reply Reply Quote 2
              • A
                Alan Kilborn @Phil Grigg
                last edited by Mar 2, 2019, 1:38 PM

                @Phil-Grigg

                Not sure what your most recent posting is trying to say…

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