Macro Selecting Search Results Text and pasting into new file



  • 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.



  • @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



  • 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.



  • @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.



  • @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="" />



  • @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



  • @Phil-Grigg

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


Log in to reply