Scrpit for automating multiple "search in Files"

  • Hey guys, feel great to be part of the community so far

    so I will sum up my problem and the things I Tried
    here is the situation : I have a text file containing a list of variable names that looks like this:
    What I want to do is to use Notepad++ “find in files” to search a certain directory for var1 then search var2 and so on…
    And the final goal is to show resaluts in “search resulat window” for each word as you can see in >> This Thread <<

    @dinkumoil suggested using a script to do so
    with pythonScript plugin I start to manipulate some commands (I’m new to python)

    so Recoreded a macros to see whats go behind and I found the following:
    for example the macros for “copy” is

    <Action type="0" message="2178" wParam="0" lParam="0" sParam="" />

    By looking at Scintilla command In scintilla.h the message 2178 is equivalnet to `

    SCI_COPY in the PythonScript documentation here which equivalent in pythonScript to command editor.copy() same for editor.research() and so on
    so my thinking was do the same for the command “Find in Files” and the macros was

    <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="String_I_Was_looking_for" />
                <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1653" wParam="0" lParam="0" sParam="path_Of_Directory" />
                <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.*" />
                <Action type="3" message="1702" wParam="0" lParam="32" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />

    These messages are discribed in Notepad++ documentation here (see last section) BUT there are not defined in Scintilla commands file.

    So I went further and searched about them in NotePad++ source code to find them in the file PowerEditor\src\ScitillaComponent\FindReplaceDlg_rc.h

    But I couldn’t find a way to Impliment them (like I did with copy command)

    Not sure if my approach is correct or i’m missing somthing and this the reason why i here i guess, and i will be glad to hear your thoughts, scripts, Ideas and help

  • Yes, you need a scripted solution, but when you were referred to that it was with the idea that it isn’t going to be super-simple…meaning that you aren’t going to find commands to make what you want happen that are similar to editor.copy(). You will have to integrate some editor object commands with some Python function calls to achieve the goal. In a couple of days I may have some time to work up an example for you if nobody does before then…

    Side note: It isn’t reasonably practical to get the results of such searching in the Notepad++ Find-result window. But…there are some perhaps reasonable alternatives to that.

  • @Alan-Kilborn Thanks for your answer yes you are right there is such commands i guess, that what i noticied by looking at Scintilla documention, but i still wonder how NotePad interpret this messages

Log in to reply